[FFmpeg-devel] [PATCH 1/2] lavc/hevc_mp4toannexb_bsf: don't fail on extradata with too few arrays
Rodger Combs
rodger.combs at gmail.com
Fri Aug 24 00:37:52 EEST 2018
I've been given a sample that does this. Not sure exactly why, but the decoder
ignores it and plays normally.
---
libavcodec/hevc_mp4toannexb_bsf.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libavcodec/hevc_mp4toannexb_bsf.c b/libavcodec/hevc_mp4toannexb_bsf.c
index 09bce5b34c..fb4ea34a93 100644
--- a/libavcodec/hevc_mp4toannexb_bsf.c
+++ b/libavcodec/hevc_mp4toannexb_bsf.c
@@ -52,6 +52,11 @@ static int hevc_extradata_to_annexb(AVBSFContext *ctx)
num_arrays = bytestream2_get_byte(&gb);
for (i = 0; i < num_arrays; i++) {
+ if (bytestream2_get_bytes_left(&gb) < 3) {
+ av_log(ctx, AV_LOG_WARNING, "Extradata contained fewer arrays than indicated\n");
+ break;
+ }
+
int type = bytestream2_get_byte(&gb) & 0x3f;
int cnt = bytestream2_get_be16(&gb);
--
2.18.0
More information about the ffmpeg-devel
mailing list