[git] GCRYPT - branch, master, updated. libgcrypt-1.6.0-237-g46c0726
jussi.kivilinna at iki.fi
Mon Jul 27 10:15:41 CEST 2015
On 27.07.2015 08:45, Werner Koch wrote:
> On Sun, 26 Jul 2015 16:00, cvs at cvs.gnupg.org said:
>> commit 46c072669eb81ed610cc5b3c0dc0c75a143afbb4
>> Fix undefined behavior wrt memcpy
>> * cipher/cipher-gcm.c: Do not copy zero bytes from an empty buffer. Let
>> the function continue to add padding as needed though.
> I think it is a bit surprising that buf_cpy does not behave similar to
> memcpy and requires the caller to check that LEN is greater than zero.
> Would it be a noticeable loss of speed if buf_cpy would do the test
> instead of the caller?
Regular buf_cpy can handle the srcbuf==NULL && len==0 case (undefined for
memcpy) without problem.
Issue is that on x86, buf_cpy just uses memcpy directly (for faster
code generation) and Peter caught undefined memcpy usage (srcbuf==NULL
&& len==0) with UndefinedBehaviorSanitizer. I guess buffer length check
could be add to x86 version of buf_cpy.
More information about the Gcrypt-devel