[FFmpeg-cvslog] avcodec/mjpegdec: Fix undefined shift

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun Apr 27 07:29:28 CEST 2014


On 27.04.2014, at 05:45, git at videolan.org (Michael Niedermayer) wrote:
> ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Apr 27 05:32:56 2014 +0200| [b4329605289e25bb071ec1c1182bf25fc83b09aa] | committer: Michael Niedermayer
> 
> avcodec/mjpegdec: Fix undefined shift
> 
> Fixes CID1194388
> 
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> 
>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b4329605289e25bb071ec1c1182bf25fc83b09aa
> ---
> 
> libavcodec/mjpegdec.c |    2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
> index f2f5498..df1ce1e 100644
> --- a/libavcodec/mjpegdec.c
> +++ b/libavcodec/mjpegdec.c
> @@ -1272,7 +1272,7 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss,
>     }
> 
>     if (!Al) {
> -        s->coefs_finished[c] |= (1LL << (se + 1)) - (1LL << ss);
> +        s->coefs_finished[c] |= (2LL << se) - (1LL << ss);

Is that actually fully fixed then?
Isn't the shift already undefined if shifting into the sign bit, which would happen still for exactly the same values? (though in contrast to shifting by 64 it would probably still work normally)
(I admit I didn't look at the surrounding code, and I agree with the change anyway since I consider it more readable)


More information about the ffmpeg-cvslog mailing list