Re: null iv parameter passed to combo_init()

From: Zhihong Yu <zyu(at)yugabyte(dot)com>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: null iv parameter passed to combo_init()
Date: 2022-01-09 20:38:23
Message-ID: CALNJ-vSf3zDrYm6RqoKqD8CkM9J97mmKroN2HD5ryEO6V6oT6Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Jan 9, 2022 at 8:48 AM Noah Misch <noah(at)leadboat(dot)com> wrote:

> On Sun, Jan 09, 2022 at 04:37:32AM -0800, Zhihong Yu wrote:
> > On Sat, Jan 8, 2022 at 11:32 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > > Noah Misch <noah(at)leadboat(dot)com> writes:
> > > > On further thought, I would write it this way:
> > >
> > > > - else
> > > > + else if (ivlen != 0)
> > > > memcpy(ivbuf, iv, ivlen);
> > >
> > > FWIW, I liked the "ivlen > 0" formulation better. They should be
> > > equivalent, because ivlen is unsigned, but it just seems like "> 0"
> > > is more natural.
>
> If I were considering the one code site in isolation, I'd pick "ivlen > 0".
> But of the four sites identified so far, three have signed length
> variables.
> Since we're likely to get more examples of this pattern, some signed and
> some
> unsigned, I'd rather use a style that does the optimal thing whether or not
> the variable is signed. What do you think?
>
> > Patch v4 is attached.
>
> Does this pass the test procedure shown upthread?
>
Hi,
I installed gcc 4.9.3

When I ran:
./configure CFLAGS='-fsanitize=undefined
-fsanitize-undefined-trap-on-error'

I saw:

configure:3977: $? = 0
configure:3966: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:3977: $? = 1
configure:3966: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:3977: $? = 1
configure:3997: checking whether the C compiler works
configure:4019: gcc -fsanitize=undefined -fsanitize-undefined-trap-on-error
conftest.c >&5
gcc: error: unrecognized command line option
'-fsanitize-undefined-trap-on-error'
configure:4023: $? = 1
configure:4061: result: no

I wonder if a higher version gcc is needed.

FYI

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Anders Kaseorg 2022-01-09 20:50:54 Re: [PATCH] Prefer getenv("HOME") to find the UNIX home directory
Previous Message Maciek Sakrejda 2022-01-09 19:58:18 Re: warn if GUC set to an invalid shared library