Skip to content
Snippets Groups Projects
Commit 3ef38c41 authored by Michael Niedermayer's avatar Michael Niedermayer
Browse files

avcodec/dvdsub_parser: Allocate input padding

Fixes: out of array read
Fixes: 9350/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DVDSUB_fuzzer-5746777750765568

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg


Signed-off-by: default avatarMichael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit cd86b5cf)
Signed-off-by: default avatarMichael Niedermayer <michael@niedermayer.cc>
parent 40ed4090
Branches 1-testing
No related tags found
No related merge requests found
...@@ -57,7 +57,11 @@ static int dvdsub_parse(AVCodecParserContext *s, ...@@ -57,7 +57,11 @@ static int dvdsub_parse(AVCodecParserContext *s,
if (pc->packet_len == 0) /* HD-DVD subpicture packet */ if (pc->packet_len == 0) /* HD-DVD subpicture packet */
pc->packet_len = AV_RB32(buf+2); pc->packet_len = AV_RB32(buf+2);
av_freep(&pc->packet); av_freep(&pc->packet);
pc->packet = av_malloc(pc->packet_len); if ((unsigned)pc->packet_len > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) {
av_log(avctx, AV_LOG_ERROR, "packet length %d is invalid\n", pc->packet_len);
return buf_size;
}
pc->packet = av_malloc(pc->packet_len + AV_INPUT_BUFFER_PADDING_SIZE);
} }
if (pc->packet) { if (pc->packet) {
if (pc->packet_index + buf_size <= pc->packet_len) { if (pc->packet_index + buf_size <= pc->packet_len) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment