Re: Re: bug in pgcrypto 0.3
От | Marko Kreen |
---|---|
Тема | Re: Re: bug in pgcrypto 0.3 |
Дата | |
Msg-id | 20010514234712.A21849@l-t.ee обсуждение исходный текст |
Ответ на | Re: Re: bug in pgcrypto 0.3 (Ian Lance Taylor <ian@airs.com>) |
Ответы |
Re: Re: bug in pgcrypto 0.3
|
Список | pgsql-hackers |
On Mon, May 14, 2001 at 01:15:59PM -0700, Ian Lance Taylor wrote: > Bruce Momjian <pgman@candle.pha.pa.us> writes: > > Applied to 7.1.X and 7.2. > > But, but... ;) > > > - return srclen + (srclen / 3) + (srclen / (76 / 2)); > > > + return srclen + (srclen + 2 / 3) + (srclen / (76 / 2)) + 2; > > (srclen + 2 / 3) is always the same as (srclen). > > Perhaps this was meant to be ((srclen + 2) / 3)? I guess too... Its no good to create patches half-asleep... > The current code is safe, but weird. But I got very good response time :) Well, the correct code - that corresponds to current encode - is below. I even got the linefeed stuff wrong. -- marko Index: contrib/pgcrypto/encode.c =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/contrib/pgcrypto/encode.c,v retrieving revision 1.5 diff -u -r1.5 encode.c --- contrib/pgcrypto/encode.c 2001/05/13 02:17:09 1.5 +++ contrib/pgcrypto/encode.c 2001/05/14 21:29:43 @@ -349,7 +349,8 @@uintb64_enc_len(uint srclen){ - return srclen + (srclen + 2 / 3) + (srclen / (76 / 2)) + 2; + /* 3 bytes will be converted to 4, linefeed after 76 chars */ + return (srclen + 2) * 4 / 3 + srclen / (76 * 3 / 4);}uint
В списке pgsql-hackers по дате отправления: