Re: null iv parameter passed to combo_init()

2022-01-13 Thread Zhihong Yu
On Thu, Jan 13, 2022 at 9:09 PM Zhihong Yu wrote: > > > On Thu, Jan 13, 2022 at 8:09 PM Noah Misch wrote: > >> On Sun, Jan 09, 2022 at 06:45:09PM -0800, Zhihong Yu wrote: >> > On Sun, Jan 9, 2022 at 1:27 PM Zhihong Yu wrote: >> > > After installing gcc-11, ./configure passed (with >> 0003-memcp

Re: null iv parameter passed to combo_init()

2022-01-13 Thread Zhihong Yu
On Thu, Jan 13, 2022 at 8:09 PM Noah Misch wrote: > On Sun, Jan 09, 2022 at 06:45:09PM -0800, Zhihong Yu wrote: > > On Sun, Jan 9, 2022 at 1:27 PM Zhihong Yu wrote: > > > After installing gcc-11, ./configure passed (with > 0003-memcpy-null.patch). > > > In the output of `make check-world`, I don

Re: null iv parameter passed to combo_init()

2022-01-13 Thread Noah Misch
On Sun, Jan 09, 2022 at 06:45:09PM -0800, Zhihong Yu wrote: > On Sun, Jan 9, 2022 at 1:27 PM Zhihong Yu wrote: > > After installing gcc-11, ./configure passed (with 0003-memcpy-null.patch). > > In the output of `make check-world`, I don't see `runtime error`. That's expected. With -fsanitize-und

Re: null iv parameter passed to combo_init()

2022-01-13 Thread Zhihong Yu
On Wed, Jan 12, 2022 at 7:08 PM Zhihong Yu wrote: > > > On Wed, Jan 12, 2022 at 6:49 PM Noah Misch wrote: > >> On Mon, Jan 10, 2022 at 03:34:27PM -0800, Zhihong Yu wrote: >> > On Sun, Jan 9, 2022 at 6:45 PM Zhihong Yu wrote: >> > > gcc -Wall -Wmissing-prototypes -Wpointer-arith >> > > -Wdeclara

Re: null iv parameter passed to combo_init()

2022-01-12 Thread Zhihong Yu
On Wed, Jan 12, 2022 at 6:49 PM Noah Misch wrote: > On Mon, Jan 10, 2022 at 03:34:27PM -0800, Zhihong Yu wrote: > > On Sun, Jan 9, 2022 at 6:45 PM Zhihong Yu wrote: > > > gcc -Wall -Wmissing-prototypes -Wpointer-arith > > > -Wdeclaration-after-statement -Werror=vla -Wendif-labels > > > -Wmissing

Re: null iv parameter passed to combo_init()

2022-01-12 Thread Noah Misch
On Mon, Jan 10, 2022 at 03:34:27PM -0800, Zhihong Yu wrote: > On Sun, Jan 9, 2022 at 6:45 PM Zhihong Yu wrote: > > gcc -Wall -Wmissing-prototypes -Wpointer-arith > > -Wdeclaration-after-statement -Werror=vla -Wendif-labels > > -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-typ

Re: null iv parameter passed to combo_init()

2022-01-10 Thread Zhihong Yu
On Sun, Jan 9, 2022 at 6:45 PM Zhihong Yu wrote: > > > On Sun, Jan 9, 2022 at 1:27 PM Zhihong Yu wrote: > >> >> >> On Sun, Jan 9, 2022 at 12:38 PM Zhihong Yu wrote: >> >>> >>> >>> On Sun, Jan 9, 2022 at 8:48 AM Noah Misch wrote: >>> On Sun, Jan 09, 2022 at 04:37:32AM -0800, Zhihong Yu wro

Re: null iv parameter passed to combo_init()

2022-01-09 Thread Zhihong Yu
On Sun, Jan 9, 2022 at 1:27 PM Zhihong Yu wrote: > > > On Sun, Jan 9, 2022 at 12:38 PM Zhihong Yu wrote: > >> >> >> On Sun, Jan 9, 2022 at 8:48 AM Noah Misch 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 wrote: >>> > >

Re: null iv parameter passed to combo_init()

2022-01-09 Thread Zhihong Yu
On Sun, Jan 9, 2022 at 12:38 PM Zhihong Yu wrote: > > > On Sun, Jan 9, 2022 at 8:48 AM Noah Misch 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 wrote: >> > > Noah Misch writes: >> > > > On further thought, I would write it

Re: null iv parameter passed to combo_init()

2022-01-09 Thread Zhihong Yu
On Sun, Jan 9, 2022 at 8:48 AM Noah Misch 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 wrote: > > > Noah Misch writes: > > > > On further thought, I would write it this way: > > > > > > > - else > > > > +

Re: null iv parameter passed to combo_init()

2022-01-09 Thread Tom Lane
Noah Misch writes: > On Sun, Jan 09, 2022 at 04:37:32AM -0800, Zhihong Yu wrote: >> On Sat, Jan 8, 2022 at 11:32 PM Tom Lane wrote: >>> 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. >

Re: null iv parameter passed to combo_init()

2022-01-09 Thread Noah Misch
On Sun, Jan 09, 2022 at 04:37:32AM -0800, Zhihong Yu wrote: > On Sat, Jan 8, 2022 at 11:32 PM Tom Lane wrote: > > Noah Misch writes: > > > On further thought, I would write it this way: > > > > > - else > > > + else if (ivlen != 0) > > > memcpy(ivbuf,

Re: null iv parameter passed to combo_init()

2022-01-09 Thread Zhihong Yu
On Sat, Jan 8, 2022 at 11:32 PM Tom Lane wrote: > Noah Misch 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

Re: null iv parameter passed to combo_init()

2022-01-08 Thread Tom Lane
Noah Misch 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 see

Re: null iv parameter passed to combo_init()

2022-01-08 Thread Zhihong Yu
On Sat, Jan 8, 2022 at 7:11 PM Noah Misch wrote: > On Sat, Jan 08, 2022 at 06:52:14PM -0800, Zhihong Yu wrote: > > On Sat, Jan 8, 2022 at 5:52 PM Noah Misch wrote: > > > On Fri, Jan 07, 2022 at 04:32:01PM -0800, Zhihong Yu wrote: > > > > I agree it's time to fix cases like this, given > > > http

Re: null iv parameter passed to combo_init()

2022-01-08 Thread Noah Misch
On Sat, Jan 08, 2022 at 06:52:14PM -0800, Zhihong Yu wrote: > On Sat, Jan 8, 2022 at 5:52 PM Noah Misch wrote: > > On Fri, Jan 07, 2022 at 04:32:01PM -0800, Zhihong Yu wrote: > > I agree it's time to fix cases like this, given > > https://postgr.es/m/flat/20200904023648.gb3426...@rfd.leadboat.com

Re: null iv parameter passed to combo_init()

2022-01-08 Thread Zhihong Yu
On Sat, Jan 8, 2022 at 5:52 PM Noah Misch wrote: > On Fri, Jan 07, 2022 at 04:32:01PM -0800, Zhihong Yu wrote: > > In contrib/pgcrypto/pgcrypto.c : > > > > err = px_combo_init(c, (uint8 *) VARDATA_ANY(key), klen, NULL, 0); > > > > Note: NULL is passed as iv. > > > > When combo_init() is calle

Re: null iv parameter passed to combo_init()

2022-01-08 Thread Noah Misch
On Fri, Jan 07, 2022 at 04:32:01PM -0800, Zhihong Yu wrote: > In contrib/pgcrypto/pgcrypto.c : > > err = px_combo_init(c, (uint8 *) VARDATA_ANY(key), klen, NULL, 0); > > Note: NULL is passed as iv. > > When combo_init() is called, > > if (ivlen > ivs) > memcpy(ivbuf, iv,

null iv parameter passed to combo_init()

2022-01-07 Thread Zhihong Yu
Hi, In contrib/pgcrypto/pgcrypto.c : err = px_combo_init(c, (uint8 *) VARDATA_ANY(key), klen, NULL, 0); Note: NULL is passed as iv. When combo_init() is called, if (ivlen > ivs) memcpy(ivbuf, iv, ivs); else memcpy(ivbuf, iv, ivlen); It seems we need