ffmpeg | branch: release/4.3 | Michael Niedermayer <[email protected]> | 
Sun Jan 31 14:59:27 2021 +0100| [fc0453d3e4e04cad2d71dc19489abdfb9a39c66f] | 
committer: Michael Niedermayer

avcodec/hevc_sei: Check payload size in decode_nal_sei_message()

Fixes: out of array access
Fixes: 
29392/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-4821602850177024.fuzz

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <[email protected]>
(cherry picked from commit 0791a515d38fd35c1e2a309ec8f4015153687b8c)
Signed-off-by: Michael Niedermayer <[email protected]>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fc0453d3e4e04cad2d71dc19489abdfb9a39c66f
---

 libavcodec/hevc_sei.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index 60570690cf..b4b90b570b 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -343,6 +343,8 @@ static int decode_nal_sei_message(GetBitContext *gb, void 
*logctx, HEVCSEI *s,
         byte          = get_bits(gb, 8);
         payload_size += byte;
     }
+    if (get_bits_left(gb) < 8LL*payload_size)
+        return AVERROR_INVALIDDATA;
     if (nal_unit_type == HEVC_NAL_SEI_PREFIX) {
         return decode_nal_sei_prefix(gb, logctx, s, ps, payload_type, 
payload_size);
     } else { /* nal_unit_type == NAL_SEI_SUFFIX */

_______________________________________________
ffmpeg-cvslog mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to