[FFmpeg-devel] [PATCH 2/2] h2645_parse: don't overread AnnexB NALs within an avc stream

Hendrik Leppkes h.leppkes at gmail.com
Thu Jul 7 21:21:18 EEST 2016


We know the maximum size of an AnnexB NAL, signaling it as the maximum
NAL size allows ff_h2645_extract_rbsp to determine the correct size.
---
 libavcodec/h2645_parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c
index 09fbc80..33eec3d 100644
--- a/libavcodec/h2645_parse.c
+++ b/libavcodec/h2645_parse.c
@@ -290,7 +290,7 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
 
             buf           += 3;
             length        -= 3;
-            extract_length = length;
+            extract_length = FFMIN(length, next_avc - buf);
 
             if (buf >= next_avc) {
                 /* skip to the start of the next NAL */
-- 
2.9.0.windows.1



More information about the ffmpeg-devel mailing list