qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 2/3] crypto: avoid undefined behavior in nett


From: Daniel P. Berrange
Subject: Re: [Qemu-devel] [PATCH v3 2/3] crypto: avoid undefined behavior in nettle calls
Date: Fri, 17 Jul 2015 11:55:43 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

On Thu, Jul 16, 2015 at 06:04:00PM +0200, Radim Krčmář wrote:
> Calling a function pointer that was cast from an incompatible function
> results in undefined behavior.  'void *' isn't compatible with 'struct
> XXX *', so we can't cast to nettle_cipher_func, but have to provide a
> wrapper.  (Conversion from 'void *' to 'struct XXX *' might require
> computation, which won't be done if we drop argument's true type and
> pointers can have different sizes so passing arguments on stack would
> bug.)
> 
> Having two different prototypes based on nettle version doesn't make
> this solution any nicer.
> 
> Reported-by: Peter Maydell <address@hidden>
> Signed-off-by: Radim Krčmář <address@hidden>
> ---
>  v3: make wrappers 'static'
>  v2: new [Peter]
> 
>  crypto/cipher-nettle.c | 43 +++++++++++++++++++++++++++++++++++++++----
>  1 file changed, 39 insertions(+), 4 deletions(-)

Reviewed-by: Daniel P. Berrange <address@hidden>

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|



reply via email to

[Prev in Thread] Current Thread [Next in Thread]