Commit 360bc0d9 authored by Andreas Cadhalpun's avatar Andreas Cadhalpun

smvjpegdec: make sure cur_frame is not negative

This fixes a heap-buffer-overflow detected by AddressSanitizer.
Reviewed-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
Signed-off-by: 's avatarAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
parent 005d058f
......@@ -152,6 +152,10 @@ static int smvjpeg_decode_frame(AVCodecContext *avctx, void *data, int *data_siz
cur_frame = avpkt->pts % s->frames_per_jpeg;
/* cur_frame is later used to calculate the buffer offset, so it mustn't be negative */
if (cur_frame < 0)
cur_frame += s->frames_per_jpeg;
/* Are we at the start of a block? */
if (!cur_frame) {
av_frame_unref(mjpeg_data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment