diff mbox series

[FFmpeg-devel,2/2] avcodec/mobiclip: Use get_ue_golomb_31() where possible

Message ID 20201107010603.552387-2-andreas.rheinhardt@gmail.com
State Accepted
Commit 33996444ee5138f4dba74e26ede7fad5a9598c87
Headers show
Series [FFmpeg-devel,1/2] avcodec/gdv: Remove dead check | expand

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 Nov. 7, 2020, 1:06 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/mobiclip.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Andreas Rheinhardt Nov. 15, 2020, 7:18 a.m. UTC | #1
Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavcodec/mobiclip.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c
> index 9fa88e84a0..42d33cf6a5 100644
> --- a/libavcodec/mobiclip.c
> +++ b/libavcodec/mobiclip.c
> @@ -539,11 +539,11 @@ static int add_pframe_coefficients(AVCodecContext *avctx, AVFrame *frame,
>  {
>      MobiClipContext *s = avctx->priv_data;
>      GetBitContext *gb = &s->gb;
> -    int ret, idx = get_ue_golomb(gb);
> +    int ret, idx = get_ue_golomb_31(gb);
>  
>      if (idx == 0) {
>          ret = add_coefficients(avctx, frame, bx, by, size, plane);
> -    } else if (idx < FF_ARRAY_ELEMS(pframe_block4x4_coefficients_tab)) {
> +    } else if ((unsigned)idx < FF_ARRAY_ELEMS(pframe_block4x4_coefficients_tab)) {
>          int flags = pframe_block4x4_coefficients_tab[idx];
>  
>          for (int y = by; y < by + 8; y += 4) {
> @@ -1012,8 +1012,8 @@ static int process_block(AVCodecContext *avctx, AVFrame *frame,
>          return predict_intra(avctx, frame, x, y, pmode, 0, 8, plane);
>      }
>  
> -    tmp = get_ue_golomb(gb);
> -    if (tmp < 0 || tmp > FF_ARRAY_ELEMS(block4x4_coefficients_tab))
> +    tmp = get_ue_golomb_31(gb);
> +    if ((unsigned)tmp > FF_ARRAY_ELEMS(block4x4_coefficients_tab))
>          return AVERROR_INVALIDDATA;
>  
>      if (tmp == 0) {
> 
Will apply this later today unless there are objections.

- Andreas
diff mbox series

Patch

diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c
index 9fa88e84a0..42d33cf6a5 100644
--- a/libavcodec/mobiclip.c
+++ b/libavcodec/mobiclip.c
@@ -539,11 +539,11 @@  static int add_pframe_coefficients(AVCodecContext *avctx, AVFrame *frame,
 {
     MobiClipContext *s = avctx->priv_data;
     GetBitContext *gb = &s->gb;
-    int ret, idx = get_ue_golomb(gb);
+    int ret, idx = get_ue_golomb_31(gb);
 
     if (idx == 0) {
         ret = add_coefficients(avctx, frame, bx, by, size, plane);
-    } else if (idx < FF_ARRAY_ELEMS(pframe_block4x4_coefficients_tab)) {
+    } else if ((unsigned)idx < FF_ARRAY_ELEMS(pframe_block4x4_coefficients_tab)) {
         int flags = pframe_block4x4_coefficients_tab[idx];
 
         for (int y = by; y < by + 8; y += 4) {
@@ -1012,8 +1012,8 @@  static int process_block(AVCodecContext *avctx, AVFrame *frame,
         return predict_intra(avctx, frame, x, y, pmode, 0, 8, plane);
     }
 
-    tmp = get_ue_golomb(gb);
-    if (tmp < 0 || tmp > FF_ARRAY_ELEMS(block4x4_coefficients_tab))
+    tmp = get_ue_golomb_31(gb);
+    if ((unsigned)tmp > FF_ARRAY_ELEMS(block4x4_coefficients_tab))
         return AVERROR_INVALIDDATA;
 
     if (tmp == 0) {