On 17 May 2021 01:20:24 -0700, Brad Hards wrote: > Signed-off-by: Brad Hards <br...@frogmouth.net> > --- > libavcodec/libx265.c | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c > index a1bd205201..d66506dda9 100644 > --- a/libavcodec/libx265.c > +++ b/libavcodec/libx265.c > @@ -484,6 +484,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, > AVPacket *pkt, > int nnal; > int ret; > int i; > + int total_unregistered_sei; > > ctx->api->picture_init(ctx->params, &x265pic); > > @@ -515,6 +516,27 @@ static int libx265_encode_frame(AVCodecContext *avctx, > AVPacket *pkt, > > memcpy(x265pic.userData, &pic->reordered_opaque, > sizeof(pic->reordered_opaque)); > } > + for (int j = 0; j < pic->nb_side_data; j++) > + if (pic->side_data[j]->type == AV_FRAME_DATA_SEI_UNREGISTERED) > + total_unregistered_sei++; > + if (total_unregistered_sei > 0) { > + x265_sei *sei = &(x265pic.userSEI); > + sei->payloads = av_realloc_array(sei->payloads, > + sei->numPayloads + > total_unregistered_sei, > + sizeof(x265_sei_payload)); > + if (!sei->payloads) { > + sei->numPayloads = 0; > + return AVERROR(ENOMEM); > + } else > + for (int j = 0; j < pic->nb_side_data; j++) > + if (pic->side_data[j]->type == > AV_FRAME_DATA_SEI_UNREGISTERED) { > + x265_sei_payload *payload = > &(sei->payloads[sei->numPayloads]); > + payload->payload = pic->side_data[j]->data; > + payload->payloadSize = pic->side_data[j]->size; > + payload->payloadType = USER_DATA_UNREGISTERED; > + sei->numPayloads++; > + } > + } > } > > ret = ctx->api->encoder_encode(ctx->encoder, &nal, &nnal, > -- > 2.27.0
Hello, I have noticed that the total_unregistered_sei is not being initialised. This will lead to race condition. >From e5fce56283867cd70fc3b675944a8e691ca97581 Mon Sep 17 00:00:00 2001 From: Ladislav Macoun <ladislavmac...@gmail.com> Date: Fri, 17 Sep 2021 12:21:03 +0200 Subject: [PATCH] libavcodec/libx265: fix uninitialized variable Fix uninitialized variable introduced in 9dee81a32f Signed-off-by: Ladislav Macoun <ladislavmac...@gmail.com> --- libavcodec/libx265.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index 52bf3b26bd..692353daa5 100644 --- a/libavcodec/libx265.c +++ b/libavcodec/libx265.c @@ -484,7 +484,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt, int nnal; int ret; int i; - int total_unregistered_sei; + int total_unregistered_sei = 0; ctx->api->picture_init(ctx->params, &x265pic); -- 2.30.1 (Apple Git-130) Regards, Ladislav Macoun _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".