mjpegdec: extend check for incompatible values of s->rgb and s->ls
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Thu, 31 Dec 2015 15:55:43 +0000 (16:55 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 15 Jan 2016 16:23:54 +0000 (17:23 +0100)
commita5fb5a18e3e234ded3f18926d0cbc411504ab99e
tree36c1b5ceb8689e7f2b8bc755c434d4af0dc5909e
parentbb70069e6a5c6786825234d44d808150784bb36b
mjpegdec: extend check for incompatible values of s->rgb and s->ls

This can happen if s->ls changes from 0 to 1, but picture allocation is
skipped due to s->interlaced.

In that case ff_jpegls_decode_picture could be called even though the
s->picture_ptr frame has the wrong pixel format and thus a wrong
linesize, which results in a too small zero buffer being allocated.

This fixes an out-of-bounds read in ls_decode_line.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit 7ea2db6eafa0a8a9497aab20be2cfc8742a59072)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/mjpegdec.c