diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-06-03 00:16:52 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-06-03 00:16:52 +0200 |
commit | cff8d01e15174aeafa91158ccb7576f9a607d1bf (patch) | |
tree | 8dd39de9b3298b82a7e16744c0feb332e02efa45 | |
parent | 8c118207ea0b2fa4a1e8e54f19965c7dfda3755c (diff) | |
parent | 0af5a774ebc96ae9018926dc8b276c7f39767e3e (diff) | |
download | ffmpeg-cff8d01e15174aeafa91158ccb7576f9a607d1bf.tar.gz |
Merge commit '0af5a774ebc96ae9018926dc8b276c7f39767e3e' into release/1.1
* commit '0af5a774ebc96ae9018926dc8b276c7f39767e3e':
jpegls: check the scan offset
jpegls: factorize return paths
jpegls: return meaningful errors
mpegvideo: allocate sufficiently large scratch buffer for interlaced vid
Conflicts:
libavcodec/jpeglsdec.c
libavcodec/mpegvideo.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/jpeglsdec.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c index 516a82fc90..4ab68da8b4 100644 --- a/libavcodec/jpeglsdec.c +++ b/libavcodec/jpeglsdec.c @@ -70,13 +70,13 @@ int ff_jpegls_decode_lse(MJpegDecodeContext *s) case 2: case 3: av_log(s->avctx, AV_LOG_ERROR, "palette not supported\n"); - return -1; + return AVERROR(ENOSYS); case 4: av_log(s->avctx, AV_LOG_ERROR, "oversize image not supported\n"); - return -1; + return AVERROR(ENOSYS); default: av_log(s->avctx, AV_LOG_ERROR, "invalid id %d\n", id); - return -1; + return AVERROR_INVALIDDATA; } av_dlog(s->avctx, "ID=%i, T=%i,%i,%i\n", id, s->t1, s->t2, s->t3); @@ -262,7 +262,7 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor int i, t = 0; uint8_t *zero, *last, *cur; JLSState *state; - int off = 0, stride = 1, width, shift; + int off = 0, stride = 1, width, shift, ret = 0; zero = av_mallocz(s->picture.linesize[0]); last = zero; @@ -294,6 +294,10 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor ilv, point_transform, s->bits, s->cur_scan); } if(ilv == 0) { /* separate planes */ + if (s->cur_scan > s->nb_components) { + ret = AVERROR_INVALIDDATA; + goto end; + } stride = (s->nb_components > 1) ? 3 : 1; off = av_clip(s->cur_scan - 1, 0, stride - 1); width = s->width * stride; @@ -333,11 +337,10 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor last = cur; cur += s->picture.linesize[0]; } - } else if(ilv == 2) { /* sample interleaving */ + } else if (ilv == 2) { /* sample interleaving */ av_log(s->avctx, AV_LOG_ERROR, "Sample interleaved images are not supported.\n"); - av_free(state); - av_free(zero); - return -1; + ret = AVERROR_PATCHWELCOME; + goto end; } if(shift){ /* we need to do point transform or normalize samples */ @@ -365,10 +368,12 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor } } } + +end: av_free(state); av_free(zero); - return 0; + return ret; } |