mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-04-20 19:34:49 +02:00
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 <jamrial@gmail.com>
This commit is contained in:
@@ -369,8 +369,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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user