aboutsummaryrefslogtreecommitdiffstats
path: root/tools/sidxindex.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-09-23 02:38:49 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-01-11 15:15:53 +0100
commit4d8beeaa8f5746ce243c3cfa95100289b987307e (patch)
treed38e5c57dfb0d9e637ffd798fb927c4f2d6691a0 /tools/sidxindex.c
parent71eee0d4dc55356ce4127908f0d5f6411dc71c6d (diff)
downloadffmpeg-4d8beeaa8f5746ce243c3cfa95100289b987307e.tar.gz
avformat/cafenc: Don't segfault upon allocation error
If an array for the packet sizes could not be successfully reallocated when writing a packet, the CAF muxer frees said array, but does not reset the number of valid bytes. As a result, when the trailer is written later, avio_write tries to read that many bytes from NULL, which segfaults. Fix this by not freeing the array in case of error; also, postpone writing the packet data after having successfully (re)allocated the array, so that even on allocation error the file can be correctly finalized. Also remove an unnecessary resetting of the number of size entries used at the end. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> (cherry picked from commit 19a6b51fe61b915b734319b5d917192108df8188)
Diffstat (limited to 'tools/sidxindex.c')
0 files changed, 0 insertions, 0 deletions