aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-11-19 11:49:03 +0000
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-11-19 11:49:03 +0000
commitb711aaa2d8035b8a14bbdf0315cf2cea48dee890 (patch)
tree2ea93da1f02d1eb77fc4b1ed5acdea1093588d2c /libavcodec
parent8a724ed84d954a36325a4b5fccb60f819bcfc3c0 (diff)
downloadffmpeg-b711aaa2d8035b8a14bbdf0315cf2cea48dee890.tar.gz
Disable image flipping during JPEG decoding if CODEC_FLAG_EMU_EDGE is set
instead of either aborting on the assert or crashing due to writing beyond the array due to insufficient padding. Originally committed as revision 20552 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mjpegdec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 812d69bd06..3cf408dfe9 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -770,6 +770,10 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, i
uint8_t* data[MAX_COMPONENTS];
int linesize[MAX_COMPONENTS];
+ if(s->flipped && s->avctx->flags & CODEC_FLAG_EMU_EDGE) {
+ av_log(s->avctx, AV_LOG_ERROR, "Can not flip image with CODEC_FLAG_EMU_EDGE set!\n");
+ s->flipped = 0;
+ }
for(i=0; i < nb_components; i++) {
int c = s->comp_index[i];
data[c] = s->picture.data[c];
@@ -777,7 +781,6 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, i
s->coefs_finished[c] |= 1;
if(s->flipped) {
//picture should be flipped upside-down for this codec
- assert(!(s->avctx->flags & CODEC_FLAG_EMU_EDGE));
data[c] += (linesize[c] * (s->v_scount[i] * (8 * s->mb_height -((s->height/s->v_max)&7)) - 1 ));
linesize[c] *= -1;
}