Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-11-11 00:09:03 +0300
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-11-18 01:17:20 +0300
commitd8affeea82e5215463fc2288c64b42edda156e25 (patch)
tree2ecf89aa4c28131fa3517aab43c7462a8ed06885 /libavcodec/smvjpegdec.c
parent1615d83dcf6ed0401be2f8afbdd8af8d2fc56815 (diff)
smvjpegdec: make sure cur_frame is not negative
This fixes a heap-buffer-overflow detected by AddressSanitizer. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> (cherry picked from commit 360bc0d90aa66cf21e9f488e77d21db18e01ec9c) Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Diffstat (limited to 'libavcodec/smvjpegdec.c')
-rw-r--r--libavcodec/smvjpegdec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/smvjpegdec.c b/libavcodec/smvjpegdec.c
index 9057e86161..e319e5781b 100644
--- a/libavcodec/smvjpegdec.c
+++ b/libavcodec/smvjpegdec.c
@@ -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);