summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/mjpeg.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/mjpeg.c b/libavcodec/mjpeg.c
index 6f1b908e97..d281b063db 100644
--- a/libavcodec/mjpeg.c
+++ b/libavcodec/mjpeg.c
@@ -1832,9 +1832,9 @@ static int mjpeg_decode_frame(AVCodecContext *avctx,
*(dst++) = x;
if (x == 0xff)
{
- while(*src == 0xff) src++;
+ while(src<buf_end && x == 0xff)
+ x = *(src++);
- x = *(src++);
if (x >= 0xd0 && x <= 0xd7)
*(dst++) = x;
else if (x)