Revision 1207c84a libavcodec/lcldec.c

View differences:

libavcodec/lcldec.c
191 191
            if (c->flags & FLAG_MULTITHREAD) {
192 192
                mthread_inlen = *(unsigned int*)encoded;
193 193
                mthread_outlen = *(unsigned int*)(encoded+4);
194
                if (mthread_outlen > c->decomp_size) // this should not happen
195
                    mthread_outlen = c->decomp_size;
194
                mthread_outlen = FFMIN(mthread_outlen, c->decomp_size);
196 195
                mszh_dlen = mszh_decomp(encoded + 8, mthread_inlen, c->decomp_buf, c->decomp_size);
197 196
                if (mthread_outlen != mszh_dlen) {
198 197
                    av_log(avctx, AV_LOG_ERROR, "Mthread1 decoded size differs (%d != %d)\n",
......
238 237
            int ret;
239 238
            mthread_inlen = *(unsigned int*)encoded;
240 239
            mthread_outlen = *(unsigned int*)(encoded+4);
241
            if (mthread_outlen > c->decomp_size)
242
                mthread_outlen = c->decomp_size;
240
            mthread_outlen = FFMIN(mthread_outlen, c->decomp_size);
243 241
            ret = zlib_decomp(avctx, encoded + 8, mthread_inlen, 0, mthread_outlen);
244 242
            if (ret < 0) return ret;
245 243
            ret = zlib_decomp(avctx, encoded + 8 + mthread_inlen, len - mthread_inlen,

Also available in: Unified diff