diff mbox

[FFmpeg-devel,v3,2/2] lavc/hevc_mp4toannexb: Exit earlier if there is no nalu payload remaining

Message ID 20191206135541.8202-2-andriy.gelman@gmail.com
State New
Headers show

Commit Message

Andriy Gelman Dec. 6, 2019, 1:55 p.m. UTC
From: Andriy Gelman <andriy.gelman@gmail.com>

Since the nal unit payload is located after the length prefix, there is
no reason to continue reading if there is no nal unit payload remaining.
---
 libavcodec/hevc_mp4toannexb_bsf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/libavcodec/hevc_mp4toannexb_bsf.c b/libavcodec/hevc_mp4toannexb_bsf.c
index f1e1a45abd1..3ed527d8ac0 100644
--- a/libavcodec/hevc_mp4toannexb_bsf.c
+++ b/libavcodec/hevc_mp4toannexb_bsf.c
@@ -136,7 +136,7 @@  static int hevc_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out)
 
     bytestream2_init(&gb, in->data, in->size);
 
-    while (bytestream2_get_bytes_left(&gb)) {
+    while (bytestream2_get_bytes_left(&gb) > s->length_size) {
         uint32_t nalu_size = 0;
         int      nalu_type;
         int is_irap, add_extradata, extra_size, prev_size;