diff mbox series

[FFmpeg-devel,1/2] avcodec/svq3: Use av_fast_padded_malloc() instead of av_fast_malloc()

Message ID 20210320184717.168755-1-andreas.rheinhardt@gmail.com
State Accepted
Commit 3ab1a890e84cd109ad3a87b4c93f8c2de5b27f5a
Headers show
Series [FFmpeg-devel,1/2] avcodec/svq3: Use av_fast_padded_malloc() instead of av_fast_malloc()
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt March 20, 2021, 6:47 p.m. UTC
It takes care of zeroing padding (which has been forgotten here).
Also rename the size variable to indicate that this is not the size
of the current slice.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/svq3.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Andreas Rheinhardt March 22, 2021, 7:15 p.m. UTC | #1
Andreas Rheinhardt:
> It takes care of zeroing padding (which has been forgotten here).
> Also rename the size variable to indicate that this is not the size
> of the current slice.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavcodec/svq3.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
> index 54ef4add06..32accb1484 100644
> --- a/libavcodec/svq3.c
> +++ b/libavcodec/svq3.c
> @@ -92,7 +92,7 @@ typedef struct SVQ3Context {
>      GetBitContext gb;
>      GetBitContext gb_slice;
>      uint8_t *slice_buf;
> -    int slice_size;
> +    unsigned slice_buf_size;
>      int halfpel_flag;
>      int thirdpel_flag;
>      int has_watermark;
> @@ -1035,7 +1035,7 @@ static int svq3_decode_slice_header(AVCodecContext *avctx)
>  
>          skip_bits(&s->gb, 8);
>  
> -        av_fast_malloc(&s->slice_buf, &s->slice_size, slice_bytes + AV_INPUT_BUFFER_PADDING_SIZE);
> +        av_fast_padded_malloc(&s->slice_buf, &s->slice_buf_size, slice_bytes);
>          if (!s->slice_buf)
>              return AVERROR(ENOMEM);
>  
> 
Will apply this patchset tomorrow unless there are objections.

- Andreas
diff mbox series

Patch

diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index 54ef4add06..32accb1484 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -92,7 +92,7 @@  typedef struct SVQ3Context {
     GetBitContext gb;
     GetBitContext gb_slice;
     uint8_t *slice_buf;
-    int slice_size;
+    unsigned slice_buf_size;
     int halfpel_flag;
     int thirdpel_flag;
     int has_watermark;
@@ -1035,7 +1035,7 @@  static int svq3_decode_slice_header(AVCodecContext *avctx)
 
         skip_bits(&s->gb, 8);
 
-        av_fast_malloc(&s->slice_buf, &s->slice_size, slice_bytes + AV_INPUT_BUFFER_PADDING_SIZE);
+        av_fast_padded_malloc(&s->slice_buf, &s->slice_buf_size, slice_bytes);
         if (!s->slice_buf)
             return AVERROR(ENOMEM);