This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 2556db6173fecd0319249e6c8fdeb9c27589377d
Author:     James Almer <[email protected]>
AuthorDate: Fri Mar 13 20:15:24 2026 -0300
Commit:     James Almer <[email protected]>
CommitDate: Sun Mar 15 19:27:07 2026 -0300

    avcodec/bsf/extract_extradata: don't use a NULL pointer to initialize an 
empty PutByteContext
    
    Fixes UB in the form or adding a 0 offset to a NULL pointer, and 
substracting a
    NULL pointer from another.
    
    Signed-off-by: James Almer <[email protected]>
---
 libavcodec/bsf/extract_extradata.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/bsf/extract_extradata.c 
b/libavcodec/bsf/extract_extradata.c
index 14c9428b70..8a18bae94d 100644
--- a/libavcodec/bsf/extract_extradata.c
+++ b/libavcodec/bsf/extract_extradata.c
@@ -375,8 +375,9 @@ static int extract_extradata_lcevc(AVBSFContext *ctx, 
AVPacket *pkt,
     for (i = 0; i < s->h2645_pkt.nb_nals; i++) {
         H2645NAL *nal = &s->h2645_pkt.nals[i];
         if (val_in_array(extradata_nal_types, nb_extradata_nal_types, 
nal->type)) {
-            bytestream2_init_writer(&pb_extradata, NULL, 0);
-            // dummy pass to find sc, gc or ai
+            // dummy pass to find sc, gc or ai. A dummy pointer is used to 
prevent
+            // UB in PutByteContext. Nothing will be written.
+            bytestream2_init_writer(&pb_extradata, nal->data, 0);
             if (!write_lcevc_nalu(ctx, &pb_extradata, nal, 0))
                 extradata_size += nal->raw_size + 3 +
                     ff_h2645_unit_requires_zero_byte(ctx->par_in->codec_id, 
nal->type, extradata_nb_nals++);

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to