diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-08-27 00:44:26 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-09-02 11:40:45 +0200 |
commit | 8b5d15530127fea54e934043a64653859de07353 (patch) | |
tree | 5a04ff8f3b577776e33d153e426b8f9732db2576 /libavformat/hdsenc.c | |
parent | b14104a6376cd774b08cbe5fda56b34320a41b2e (diff) | |
download | ffmpeg-8b5d15530127fea54e934043a64653859de07353.tar.gz |
avformat/hevc: Fix crash on allocation failure, avoid allocations
The HEVC code currently uses an array of arrays of NALUs; one such array
contains all the SPS NALUs, one all PPS NALUs etc. The array of arrays
is grown dynamically via av_reallocp_array(), but given that the latter
function automatically frees its buffer upon reallocation error,
it may only be used with PODs, which this case is not. Even worse:
While the pointer to the arrays is reset, the counter for the number
of arrays is not, leading to a segfault in hvcc_close().
Fix this by avoiding the allocations of the array of arrays altogether.
This is easily possible because their number is bounded (by five).
Furthermore, as a byproduct we can ensure that the code always
produces the recommended ordering of VPS-SPS-PPS-SEI (which was
not guaranteed before).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat/hdsenc.c')
0 files changed, 0 insertions, 0 deletions