[FFmpeg-cvslog] avcodec/vcr1: replace redundant checks from libav ( 8aba7968dd604aae91ee42cbce0be3dad7dceb30) by asserts

Michael Niedermayer git at videolan.org
Sat Sep 7 16:37:46 CEST 2013


ffmpeg | branch: release/1.1 | Michael Niedermayer <michaelni at gmx.at> | Tue Sep  3 13:36:22 2013 +0200| [fbbd6317e2c10df2b98996afd14d0a3ee280c11f] | committer: Michael Niedermayer

avcodec/vcr1: replace redundant checks from libav (8aba7968dd604aae91ee42cbce0be3dad7dceb30)  by asserts

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 164b67ca281fa5a47b965a858c7783aa547091b8)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/vcr1.c |   13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/libavcodec/vcr1.c b/libavcodec/vcr1.c
index 39e7630..0691c9f 100644
--- a/libavcodec/vcr1.c
+++ b/libavcodec/vcr1.c
@@ -27,6 +27,7 @@
 #include "avcodec.h"
 #include "dsputil.h"
 #include "internal.h"
+#include "libavutil/avassert.h"
 #include "libavutil/internal.h"
 
 typedef struct VCR1Context {
@@ -96,9 +97,6 @@ static int vcr1_decode_frame(AVCodecContext *avctx, void *data,
     p->pict_type = AV_PICTURE_TYPE_I;
     p->key_frame = 1;
 
-    if (buf_size < 32)
-        goto packet_small;
-
     for (i = 0; i < 16; i++) {
         a->delta[i] = *bytestream++;
         bytestream++;
@@ -113,8 +111,7 @@ static int vcr1_decode_frame(AVCodecContext *avctx, void *data,
             uint8_t *cb = &a->picture.data[1][(y >> 2) * a->picture.linesize[1]];
             uint8_t *cr = &a->picture.data[2][(y >> 2) * a->picture.linesize[2]];
 
-            if (buf_size < 4 + avctx->width)
-                goto packet_small;
+            av_assert0 (buf_size >= 4 + avctx->width);
 
             for (i = 0; i < 4; i++)
                 a->offset[i] = *bytestream++;
@@ -135,8 +132,7 @@ static int vcr1_decode_frame(AVCodecContext *avctx, void *data,
                 buf_size   -= 4;
             }
         } else {
-            if (buf_size < avctx->width / 2)
-                goto packet_small;
+            av_assert0 (buf_size >= avctx->width / 2);
 
             offset = a->offset[y & 3] - a->delta[bytestream[2] & 0xF];
 
@@ -160,9 +156,6 @@ static int vcr1_decode_frame(AVCodecContext *avctx, void *data,
     *got_frame = 1;
 
     return buf_size;
-packet_small:
-    av_log(avctx, AV_LOG_ERROR, "Input packet too small.\n");
-    return AVERROR_INVALIDDATA;
 }
 
 AVCodec ff_vcr1_decoder = {



More information about the ffmpeg-cvslog mailing list