Mercurial > libavcodec.hg
changeset 10539:8d8fcc20dd30 libavcodec
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.
author | reimar |
---|---|
date | Thu, 19 Nov 2009 11:49:03 +0000 |
parents | 89527d128fc9 |
children | 526cab0b961a |
files | mjpegdec.c |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mjpegdec.c Thu Nov 19 00:05:30 2009 +0000 +++ b/mjpegdec.c Thu Nov 19 11:49:03 2009 +0000 @@ -770,6 +770,10 @@ 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 @@ 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; }