[FFmpeg-cvslog] avcodec/mpeg12: Don't pretend reading dct_dc_size_* VLCs can fail

Andreas Rheinhardt git at videolan.org
Mon Oct 12 03:42:48 EEST 2020


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Thu Oct  8 17:54:19 2020 +0200| [7800cc6e82068c6dfb5af53817f03dfda794c568] | committer: Andreas Rheinhardt

avcodec/mpeg12: Don't pretend reading dct_dc_size_* VLCs can fail

It can't because the corresponding trees don't have any loose ends.

Removing the checks also removed an instance of av_log(NULL (with a
nonsense message) from the codebase.

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7800cc6e82068c6dfb5af53817f03dfda794c568
---

 libavcodec/mdec.c      | 2 --
 libavcodec/mpeg12.h    | 4 ----
 libavcodec/mpeg12dec.c | 4 ----
 3 files changed, 10 deletions(-)

diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c
index 7e34ec568e..b16cbb6a79 100644
--- a/libavcodec/mdec.c
+++ b/libavcodec/mdec.c
@@ -71,8 +71,6 @@ static inline int mdec_decode_block_intra(MDECContext *a, int16_t *block, int n)
     } else {
         component = (n <= 3 ? 0 : n - 4 + 1);
         diff = decode_dc(&a->gb, component);
-        if (diff >= 0xffff)
-            return AVERROR_INVALIDDATA;
         a->last_dc[component] += diff;
         block[0] = a->last_dc[component] * (1 << 3);
     }
diff --git a/libavcodec/mpeg12.h b/libavcodec/mpeg12.h
index 1ec99f17e1..345d473d3a 100644
--- a/libavcodec/mpeg12.h
+++ b/libavcodec/mpeg12.h
@@ -47,10 +47,6 @@ static inline int decode_dc(GetBitContext *gb, int component)
     } else {
         code = get_vlc2(gb, ff_dc_chroma_vlc.table, DC_VLC_BITS, 2);
     }
-    if (code < 0){
-        av_log(NULL, AV_LOG_ERROR, "invalid dc code at\n");
-        return 0xffff;
-    }
     if (code == 0) {
         diff = 0;
     } else {
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 1cccfd1742..3be90d7f25 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -490,8 +490,6 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s,
         component    = (n & 1) + 1;
     }
     diff = decode_dc(&s->gb, component);
-    if (diff >= 0xffff)
-        return AVERROR_INVALIDDATA;
     dc  = s->last_dc[component];
     dc += diff;
     s->last_dc[component] = dc;
@@ -577,8 +575,6 @@ static inline int mpeg2_fast_decode_block_intra(MpegEncContext *s,
         component    = (n & 1) + 1;
     }
     diff = decode_dc(&s->gb, component);
-    if (diff >= 0xffff)
-        return AVERROR_INVALIDDATA;
     dc = s->last_dc[component];
     dc += diff;
     s->last_dc[component] = dc;



More information about the ffmpeg-cvslog mailing list