diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2023-07-31 12:08:49 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2023-08-02 18:31:59 +0200 |
commit | 27a9e1ce2262f42b900e09f872f4b98e209b8842 (patch) | |
tree | ad85c749ff6b7a6aceda00be862d3d656e17a703 | |
parent | 2d7c1479c204ef2a8b9f1c0273e0e6cddd634ed5 (diff) | |
download | ffmpeg-27a9e1ce2262f42b900e09f872f4b98e209b8842.tar.gz |
avcodec/mpegvideo_dec: Use av_fast_padded_malloc where appropriate
Will probably also fix Coverity issue #1473529.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r-- | libavcodec/mpegvideo_dec.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c index 670b0912e2..16e8b9193a 100644 --- a/libavcodec/mpegvideo_dec.c +++ b/libavcodec/mpegvideo_dec.c @@ -154,21 +154,16 @@ do {\ s->divx_packed = s1->divx_packed; if (s1->bitstream_buffer) { - if (s1->bitstream_buffer_size + - AV_INPUT_BUFFER_PADDING_SIZE > s->allocated_bitstream_buffer_size) { - av_fast_malloc(&s->bitstream_buffer, - &s->allocated_bitstream_buffer_size, - s1->allocated_bitstream_buffer_size); - if (!s->bitstream_buffer) { - s->bitstream_buffer_size = 0; - return AVERROR(ENOMEM); - } + av_fast_padded_malloc(&s->bitstream_buffer, + &s->allocated_bitstream_buffer_size, + s1->bitstream_buffer_size); + if (!s->bitstream_buffer) { + s->bitstream_buffer_size = 0; + return AVERROR(ENOMEM); } s->bitstream_buffer_size = s1->bitstream_buffer_size; memcpy(s->bitstream_buffer, s1->bitstream_buffer, s1->bitstream_buffer_size); - memset(s->bitstream_buffer + s->bitstream_buffer_size, 0, - AV_INPUT_BUFFER_PADDING_SIZE); } // linesize-dependent scratch buffer allocation |