Commit 1e4e0bd9 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/mjpegdec: change error return value to be outside the 16bit range

Fixes part of Ticket2965
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 7ac6c632
...@@ -524,7 +524,7 @@ static inline int mjpeg_decode_dc(MJpegDecodeContext *s, int dc_index) ...@@ -524,7 +524,7 @@ static inline int mjpeg_decode_dc(MJpegDecodeContext *s, int dc_index)
av_log(s->avctx, AV_LOG_WARNING, av_log(s->avctx, AV_LOG_WARNING,
"mjpeg_decode_dc: bad vlc: %d:%d (%p)\n", "mjpeg_decode_dc: bad vlc: %d:%d (%p)\n",
0, dc_index, &s->vlcs[0][dc_index]); 0, dc_index, &s->vlcs[0][dc_index]);
return 0xffff; return 0xfffff;
} }
if (code) if (code)
...@@ -541,7 +541,7 @@ static int decode_block(MJpegDecodeContext *s, int16_t *block, int component, ...@@ -541,7 +541,7 @@ static int decode_block(MJpegDecodeContext *s, int16_t *block, int component,
/* DC coef */ /* DC coef */
val = mjpeg_decode_dc(s, dc_index); val = mjpeg_decode_dc(s, dc_index);
if (val == 0xffff) { if (val == 0xfffff) {
av_log(s->avctx, AV_LOG_ERROR, "error dc\n"); av_log(s->avctx, AV_LOG_ERROR, "error dc\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
...@@ -589,7 +589,7 @@ static int decode_dc_progressive(MJpegDecodeContext *s, int16_t *block, ...@@ -589,7 +589,7 @@ static int decode_dc_progressive(MJpegDecodeContext *s, int16_t *block,
int val; int val;
s->dsp.clear_block(block); s->dsp.clear_block(block);
val = mjpeg_decode_dc(s, dc_index); val = mjpeg_decode_dc(s, dc_index);
if (val == 0xffff) { if (val == 0xfffff) {
av_log(s->avctx, AV_LOG_ERROR, "error dc\n"); av_log(s->avctx, AV_LOG_ERROR, "error dc\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
...@@ -853,7 +853,7 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p ...@@ -853,7 +853,7 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p
PREDICT(pred, topleft[i], top[i], left[i], modified_predictor); PREDICT(pred, topleft[i], top[i], left[i], modified_predictor);
dc = mjpeg_decode_dc(s, s->dc_index[i]); dc = mjpeg_decode_dc(s, s->dc_index[i]);
if(dc == 0xFFFF) if(dc == 0xFFFFF)
return -1; return -1;
left[i] = buffer[mb_x][i] = left[i] = buffer[mb_x][i] =
...@@ -944,7 +944,7 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, ...@@ -944,7 +944,7 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor,
int pred, dc; int pred, dc;
dc = mjpeg_decode_dc(s, s->dc_index[i]); dc = mjpeg_decode_dc(s, s->dc_index[i]);
if(dc == 0xFFFF) if(dc == 0xFFFFF)
return -1; return -1;
if(bits<=8){ if(bits<=8){
ptr = s->picture.data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap ptr = s->picture.data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap
...@@ -1012,7 +1012,7 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, ...@@ -1012,7 +1012,7 @@ static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor,
int pred; int pred;
dc = mjpeg_decode_dc(s, s->dc_index[i]); dc = mjpeg_decode_dc(s, s->dc_index[i]);
if(dc == 0xFFFF) if(dc == 0xFFFFF)
return -1; return -1;
if(bits<=8){ if(bits<=8){
ptr = s->picture.data[c] + ptr = s->picture.data[c] +
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment