aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-07-31 12:08:49 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-08-02 18:31:59 +0200
commit27a9e1ce2262f42b900e09f872f4b98e209b8842 (patch)
treead85c749ff6b7a6aceda00be862d3d656e17a703
parent2d7c1479c204ef2a8b9f1c0273e0e6cddd634ed5 (diff)
downloadffmpeg-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.c17
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