[FFmpeg-devel] [FFmpeg-cvslog] libavcodec/libx264: add user data unregistered SEI encoding

James Almer jamrial at gmail.com
Tue Oct 19 01:38:46 EEST 2021

On 10/18/2021 7:34 PM, Derek Buitenhuis wrote:
> On 10/18/2021 11:05 PM, Michael Niedermayer wrote:
>> This code breaks bitexact mode for some files, i have not looked into this
>> any deeper yet.
> [23:18] <@jamrial_> Daemon404: that libx264 patch conflicts with the closed caption code. it overwrites the extra_sei struct and leaks it
> ^ presumably this is why

Actually no. It calls av_fast_realloc() on a (potentially) av_malloc'd 
buffer, which i think is a valid scenario. Also, these samples have no 
closed captions, so the relevant code is never run.

The problem i guess is in the following line:

sei_payload->payload = side_data->data;

Which should be an av_memdup() or similar, because side_data->data is 
the frame's side data, and by the time the encoder tries to do something 
with it, it may have been freed.
Also, this code should set x4->pic.extra_sei.sei_free to av_free().

> - Derek
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".

More information about the ffmpeg-devel mailing list