[FFmpeg-devel] [PATCH v2] ffplay, avcodec, avformat: Don't initialize before av_packet_ref()

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Sat Mar 28 06:16:09 EET 2020


Anton Khirnov:
> Quoting Andreas Rheinhardt (2020-03-13 14:28:33)
>> It already initializes the packet.
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
>> ---
>> Resending because of 3117f47f19d051d47ba29c9b78c2ca525f0fdb45.
>>
>>  fftools/ffplay.c          | 2 +-
>>  libavcodec/qsvdec_h2645.c | 2 +-
>>  libavcodec/qsvdec_other.c | 2 +-
>>  libavformat/fifo.c        | 1 -
>>  libavformat/img2enc.c     | 8 ++++----
>>  libavformat/tee.c         | 1 -
>>  6 files changed, 7 insertions(+), 9 deletions(-)
> 
> Generally looks good, but it occurred to me that the semantics of what
> happens on failure in av_packet_ref() is unspecified, which might lead
> to those uninitialized packets now being full of random data, which
> might be dangerous.
> 
> So we might want to specify that on failure dst is reset to a clean
> state and replace the call to av_packet_free_side_data() with
> av_packet_unref().
> 
Applied, thanks.

- Andreas


More information about the ffmpeg-devel mailing list