| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Neil Conway <neilc(at)samurai(dot)com> |
| Cc: | pgsql-patches <pgsql-patches(at)postgresql(dot)org> |
| Subject: | Re: arrayfuncs: fix read of uninitialized mem |
| Date: | 2004-09-15 14:18:12 |
| Message-ID: | 3328.1095257892@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-patches |
Neil Conway <neilc(at)samurai(dot)com> writes:
> I fixed it by initializing dims_str[0] to '\0' circa line 1018 in
> current sources. While doing so I couldn't resist the temptation to fix
> a few of arrayfunc.c's crimes against good programming practise, so the
> attached patch includes some additional cosmetic improvements.
I dislike what you did at lines 983-1012 (replace a local variable by
possibly-many stores into an array). Also, as long as we're fixing
unreadable code, how about (line 1019)
for (i = j = 0, k = 1; i < ndim; k *= dims[i++], j += k);
becomes
for (i = j = 0, k = 1; i < ndim; i++)
k *= dims[i], j += k;
or some such. The empty loop body is a mistake waiting to happen.
Looks fine to me otherwise.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Karel Zak | 2004-09-15 14:21:02 | Re: Again!! locale per column for postgreSQL |
| Previous Message | Mahmoud Taghizadeh | 2004-09-15 14:01:35 | Again!! locale per column for postgreSQL |