diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-07-05 21:31:19 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-07-06 22:53:15 +0200 |
commit | aca09ed7d4832520cf10fb93faed4249726348c0 (patch) | |
tree | b577b88b43bb14573d45ad10d281b3eb9e602d28 /libavformat/rtpdec_ac3.c | |
parent | 42518d8dd02e95c47b0088788329b633858a489e (diff) | |
download | ffmpeg-aca09ed7d4832520cf10fb93faed4249726348c0.tar.gz |
avutil/mem: Handle fast allocations near UINT_MAX properly
av_fast_realloc and av_fast_mallocz? store the size of
the objects they allocate in an unsigned. Yet they overallocate
and currently they can allocate more than UINT_MAX bytes
in case a user has requested a size of about UINT_MAX * 16 / 17
or more if SIZE_MAX > UINT_MAX (and if the user increased
max_alloc_size via av_max_alloc). In this case it is impossible
to store the true size of the buffer via the unsigned*;
future requests are likely to use the (re)allocation codepath
even if the buffer is actually large enough because of
the incorrect size.
Fix this by ensuring that the actually allocated size
always fits into an unsigned. (This entails erroring out
in case the user requested more than UINT_MAX.)
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat/rtpdec_ac3.c')
0 files changed, 0 insertions, 0 deletions