Browse code

avcodec/shorten: Fix code depending on signed overflow behavior

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

Michael Niedermayer authored on 2015/05/15 23:58:51
Showing 1 changed files
... ...
@@ -129,8 +129,7 @@ static int allocate_buffers(ShortenContext *s)
129 129
             av_log(s->avctx, AV_LOG_ERROR, "nmean too large\n");
130 130
             return AVERROR_INVALIDDATA;
131 131
         }
132
-        if (s->blocksize + s->nwrap >= UINT_MAX / sizeof(int32_t) ||
133
-            s->blocksize + s->nwrap <= (unsigned)s->nwrap) {
132
+        if (s->blocksize + (uint64_t)s->nwrap >= UINT_MAX / sizeof(int32_t)) {
134 133
             av_log(s->avctx, AV_LOG_ERROR,
135 134
                    "s->blocksize + s->nwrap too large\n");
136 135
             return AVERROR_INVALIDDATA;