Commit e35c3d88 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/pgssubdec: Check for duplicate display segments

In such a duplication the previous gets overwritten and leaks

Fixes: memleak
Fixes: 12510/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PGSSUB_fuzzer-5694439226343424

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent b429c86d
...@@ -676,6 +676,11 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, ...@@ -676,6 +676,11 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size,
*/ */
break; break;
case DISPLAY_SEGMENT: case DISPLAY_SEGMENT:
if (*data_size) {
av_log(avctx, AV_LOG_ERROR, "Duplicate display segment\n");
ret = AVERROR_INVALIDDATA;
break;
}
ret = display_end_segment(avctx, data, buf, segment_length); ret = display_end_segment(avctx, data, buf, segment_length);
if (ret >= 0) if (ret >= 0)
*data_size = ret; *data_size = ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment