aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/h264_parser.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-09-05 21:24:17 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-08 20:14:00 +0200
commit2d36d2fbd775fa9e2a92b1225b1964c5a8499df3 (patch)
tree453d56bb4dfbe7e4424068be3f2a80dae2f21dbf /libavcodec/h264_parser.c
parent38ab20e591ce9d6e0b30717fca29011127b66ef7 (diff)
downloadffmpeg-2d36d2fbd775fa9e2a92b1225b1964c5a8499df3.tar.gz
avcodec/h264_parser: Fix nalsize check
Fixes: Assertion failure Fixes: 37463/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-4914693494931456 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/h264_parser.c')
-rw-r--r--libavcodec/h264_parser.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 01ea016409..cff801f613 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -83,12 +83,12 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf,
for (i = 0; i < buf_size; i++) {
if (i >= next_avc) {
- uint32_t nalsize = 0;
+ int64_t nalsize = 0;
i = next_avc;
for (j = 0; j < p->nal_length_size; j++)
nalsize = (nalsize << 8) | buf[i++];
if (!nalsize || nalsize > buf_size - i) {
- av_log(logctx, AV_LOG_ERROR, "AVC-parser: nal size %"PRIu32" "
+ av_log(logctx, AV_LOG_ERROR, "AVC-parser: nal size %"PRId64" "
"remaining %d\n", nalsize, buf_size - i);
return buf_size;
}