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>2018-07-13 19:56:10 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2018-07-18 17:57:03 +0300
commit94fda4f9ec95aee15f97686e01a43545d87944e7 (patch)
treeea3d76ff0efd0942904eb6e3323a4b460877d739
parentffc9ef8f4c742f47be5f5fe8820bb85fdb2d69b4 (diff)
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: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit cd86b5cfe278af79d6b147e122d9a72c270a9fde) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/dvdsub_parser.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/dvdsub_parser.c b/libavcodec/dvdsub_parser.c
index 8e1c48bef6..698ccb6987 100644
--- a/libavcodec/dvdsub_parser.c
+++ b/libavcodec/dvdsub_parser.c
@@ -57,7 +57,11 @@ static int dvdsub_parse(AVCodecParserContext *s,
if (pc->packet_len == 0) /* HD-DVD subpicture packet */
pc->packet_len = AV_RB32(buf+2);
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_index + buf_size <= pc->packet_len) {