@@ -1863,6 +1863,9 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
av_log(s->avctx, AV_LOG_WARNING, "skipping APPx (len=%"PRId32") for bayer-encoded image\n", len);
skip_bits(&s->gb, len);
return 0;
+ } else if (s->allow_malformed_app) {
+ skip_bits(&s->gb, len);
+ return 0;
} else
return AVERROR_INVALIDDATA;
}
@@ -2988,6 +2991,8 @@ static void decode_flush(AVCodecContext *avctx)
static const AVOption options[] = {
{ "extern_huff", "Use external huffman table.",
OFFSET(extern_huff), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VD },
+ { "allow_malformed_app", "Allow (ignore) malformed APPx chunks.",
+ OFFSET(allow_malformed_app), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VD },
{ NULL },
};
@@ -138,6 +138,7 @@ typedef struct MJpegDecodeContext {
unsigned int ljpeg_buffer_size;
int extern_huff;
+ int allow_malformed_app;
AVDictionary *exif_metadata;
AVStereo3D *stereo3d; ///!< stereoscopic information (cached, since it is read before frame allocation)