This is an automated email from the git hooks/post-receive script.
Git pushed a commit to branch master
in repository ffmpeg.
The following commit(s) were added to refs/heads/master by this push:
new 2948acd528 avformat/nal: take into account removed zero bytes when
calculating buffer size in nal_parse_units()
2948acd528 is described below
commit 2948acd528af8368094a707b83d4f4dff96f61eb
Author: James Almer <[email protected]>
AuthorDate: Tue May 5 16:25:57 2026 -0300
Commit: James Almer <[email protected]>
CommitDate: Sat May 9 11:28:46 2026 -0300
avformat/nal: take into account removed zero bytes when calculating buffer
size in nal_parse_units()
Fixes issue #23010
Signed-off-by: James Almer <[email protected]>
---
libavformat/nal.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libavformat/nal.c b/libavformat/nal.c
index f94dc90995..17b0ed1b7c 100644
--- a/libavformat/nal.c
+++ b/libavformat/nal.c
@@ -87,10 +87,10 @@ static int nal_parse_units(AVIOContext *pb, NALUList *list,
break;
nal_end = ff_nal_find_startcode(nal_start, end);
+ size_t nalu_size = nal_end - nal_start;
+ while (nalu_size > 0 && nal_start[nalu_size - 1] == 0)
+ --nalu_size;
if (pb) {
- ptrdiff_t nalu_size = nal_end - nal_start;
- while (nalu_size > 0 && nal_start[nalu_size - 1] == 0)
- --nalu_size;
avio_wb32(pb, nalu_size);
avio_write(pb, nal_start, nalu_size);
} else if (list->nb_nalus >= nalu_limit) {
@@ -102,9 +102,9 @@ static int nal_parse_units(AVIOContext *pb, NALUList *list,
return AVERROR(ENOMEM);
list->nalus = tmp;
tmp[list->nb_nalus++] = (NALU){ .offset = nal_start - p,
- .size = nal_end - nal_start };
+ .size = nalu_size };
}
- size += 4 + nal_end - nal_start;
+ size += 4 + nalu_size;
nal_start = nal_end;
}
return size;
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]