[FFmpeg-devel] [PATCH]Cast signed libopenjpeg values to unsigned before shifting

Michael Bradshaw mjbshaw at gmail.com
Fri Jan 10 17:36:58 CET 2014


On Fri, Jan 10, 2014 at 3:15 AM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:

> HI!
>
> Attached patch fixes an undefined behaviour when shifting values within the
> libopenjpeg decoder wrapper (if I understand MIchael correctly).


Yes, that's what I meant (what's in the patch). Left shifting a negative
value is undefined behavior, and while it "works fine" on many systems,
some compilers have been known to produce wrong code (when optimizing
heavily), and GCC warns future GCC versions might break code that rely on
this[1].

[1]:
http://gcc.gnu.org/onlinedocs/gcc-4.8.1/gcc/Integers-implementation.html#Integers-implementation


More information about the ffmpeg-devel mailing list