Re: [PATCHES] Fix memcmp() with different sizes.

2004-02-03 Thread Tom Lane
Kurt Roeckx <[EMAIL PROTECTED]> writes: > That assumes the memcmp starts from the first char and not from > the last. If it starts from the last you have undefined > behaviour. Hmm. I suppose you could get a reference off the end of memory; pretty improbable but we have actually seen similar bug

Re: [PATCHES] Fix memcmp() with different sizes.

2004-02-03 Thread Kurt Roeckx
On Mon, Feb 02, 2004 at 09:27:46PM -0500, Tom Lane wrote: > Kurt Roeckx <[EMAIL PROTECTED]> writes: > > - if (memcmp(re_array[i].cre_pat, text_re, text_re_len) == 0 && > > + if (VARSIZE(re_array[i].cre_pat) == text_re_len && > > + memcmp(re_array[i].cre_pat, text_re, t

Re: [PATCHES] Fix memcmp() with different sizes.

2004-02-02 Thread Tom Lane
Kurt Roeckx <[EMAIL PROTECTED]> writes: > - if (memcmp(re_array[i].cre_pat, text_re, text_re_len) == 0 && > + if (VARSIZE(re_array[i].cre_pat) == text_re_len && > + memcmp(re_array[i].cre_pat, text_re, text_re_len) == 0 && This is not actually broken. The first

[PATCHES] Fix memcmp() with different sizes.

2004-02-02 Thread Kurt Roeckx
Not everything in the re_array is the same size. This patch first checks that they actually are the same size in the first place. Kurt Index: src/backend/utils/adt/regexp.c === RCS file: /projects/cvsroot/pgsql-server/src/backend/u