#11589 closed defect (wontfix)

null check for AVSideDataDescriptor* in ffmpeg_enc.c

Reported by: uttam_32472 Owned by:
Priority: normal Component: ffmpeg
Version: 7.1 Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

ffmpeg_enc.c is accessing the struct member without null check.

const AVSideDataDescriptor *desc = av_frame_side_data_desc(frame->side_data[i]->type);
if (!(desc->props & AV_SIDE_DATA_PROP_GLOBAL))

https://github.com/FFmpeg/FFmpeg/blob/4991c1ec92874737a9c4b1bce1b3f73a23b78b20/fftools/ffmpeg_enc.c#L191

Above code can crash if the given sidedata type entry is not present in https://github.com/FFmpeg/FFmpeg/blob/4991c1ec92874737a9c4b1bce1b3f73a23b78b20/libavutil/frame.c#L31C1-L61C3

There are null checks present in https://github.com/Xilinx-Projects/ma35_ffmpeg/blob/develop/src/libavutil/frame.c for the return value of av_frame_side_data_desc() and same should be with ffmpeg_enc.c as well.

Change History (1)

comment:1 by mkver, 14 months ago

Component: avcodecffmpeg
Resolution: wontfix
Status: newclosed

av_frame_side_data_desc() is supposed to have a descriptor for every side data type known to lavu. The side data the fftools deal with are created by trusted sources, namely our libraries (e.g. libavcodec, libavfilter). They are not supposed to create unknown side data types and therefore there is no check in ffmpeg_enc.c. The situation for the callers of av_frame_side_data_desc() in libavutil is different, as they are not supposed to trust their caller's AVFrameSideDataType.

Note: See TracTickets for help on using tickets.