[FFmpeg-cvslog] avcodec/mpegvideo_dec: Use av_fast_padded_malloc where appropriate
Andreas Rheinhardt
git at videolan.org
Thu Aug 3 18:08:57 EEST 2023
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Mon Jul 31 12:08:49 2023 +0200| [27a9e1ce2262f42b900e09f872f4b98e209b8842] | committer: Andreas Rheinhardt
avcodec/mpegvideo_dec: Use av_fast_padded_malloc where appropriate
Will probably also fix Coverity issue #1473529.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=27a9e1ce2262f42b900e09f872f4b98e209b8842
---
libavcodec/mpegvideo_dec.c | 17 ++++++-----------
1 file 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
More information about the ffmpeg-cvslog
mailing list