avcodec/mjpeg2jpeg_bsf: Check ff_bsf_get_packet success
authorJan Sebechlebsky <sebechlebskyjan@gmail.com>
Sun, 1 May 2016 23:51:25 +0000 (02:51 +0300)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 2 May 2016 02:10:03 +0000 (04:10 +0200)
This fixes ticket #5487 - mjpeg2jpeg bitstream filter causes
segmentation fault with header-less mjpeg.

Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/mjpeg2jpeg_bsf.c

index 2d4cee2..6f02bc0 100644 (file)
@@ -86,6 +86,8 @@ static int mjpeg2jpeg_filter(AVBSFContext *ctx, AVPacket *out)
     uint8_t *output;
 
     ret = ff_bsf_get_packet(ctx, &in);
+    if (ret < 0)
+        return ret;
 
     if (in->size < 12) {
         av_log(ctx, AV_LOG_ERROR, "input is truncated\n");