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:
authorMichael Niedermayer <michael@niedermayer.cc>2017-01-25 14:56:52 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2017-02-03 02:27:28 +0300
commitad7a3f5294c6fc6cd45dca9ca02fd3e20f53c2c4 (patch)
tree20e7e32a9b9fb4c8bfa8537f0934e2f21d310d8d /libavcodec/utils.c
parent037bb4021c0b0b33c752850f58cf7e2ea44359b7 (diff)
avcodec/utils: Fix memleak with subtitles and sidedata
Fixes: 454/fuzz-3-ffmpeg_SUBTITLE_AV_CODEC_ID_MOV_TEXT_fuzzer Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 4ae752ff2f..f8ec4c1ae6 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2714,13 +2714,19 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
avctx->pkt_timebase, ms);
}
+ if (avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB)
+ sub->format = 0;
+ else if (avctx->codec_descriptor->props & AV_CODEC_PROP_TEXT_SUB)
+ sub->format = 1;
+
for (i = 0; i < sub->num_rects; i++) {
if (sub->rects[i]->ass && !utf8_check(sub->rects[i]->ass)) {
av_log(avctx, AV_LOG_ERROR,
"Invalid UTF-8 in decoded subtitles text; "
"maybe missing -sub_charenc option\n");
avsubtitle_free(sub);
- return AVERROR_INVALIDDATA;
+ ret = AVERROR_INVALIDDATA;
+ break;
}
}
@@ -2731,10 +2737,6 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
av_packet_unref(&pkt_recoded);
}
- if (avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB)
- sub->format = 0;
- else if (avctx->codec_descriptor->props & AV_CODEC_PROP_TEXT_SUB)
- sub->format = 1;
avctx->internal->pkt = NULL;
}