summaryrefslogtreecommitdiff
path: root/libavcodec/xxan.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-09-30 01:27:24 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-09-30 01:41:17 +0200
commit1ad36551eca99bab51bfd771488ab0ff3af01323 (patch)
treee85ae8385011f9578a43d575466ec76998f029a8 /libavcodec/xxan.c
parent7d7fb61e0df7791c6dbdc1a5aeda63f6f47bf8a8 (diff)
parentaa0dd52434768da64f1f3d8ae92bcf980c1adffc (diff)
downloadffmpeg-1ad36551eca99bab51bfd771488ab0ff3af01323.tar.gz
Merge commit 'aa0dd52434768da64f1f3d8ae92bcf980c1adffc'
* commit 'aa0dd52434768da64f1f3d8ae92bcf980c1adffc': xxan: Disallow odd width See: 77693c541a541661357a0edd5bbaae69c64b2039 See: 8ad9b48c9b5b749df8fbcd59d61278caadc478ca Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/xxan.c')
-rw-r--r--libavcodec/xxan.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libavcodec/xxan.c b/libavcodec/xxan.c
index cb913da53a..4030889bd2 100644
--- a/libavcodec/xxan.c
+++ b/libavcodec/xxan.c
@@ -52,6 +52,10 @@ static av_cold int xan_decode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "Invalid frame height: %d.\n", avctx->height);
return AVERROR(EINVAL);
}
+ if (avctx->width & 1) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid frame width: %d.\n", avctx->width);
+ return AVERROR(EINVAL);
+ }
s->buffer_size = avctx->width * avctx->height;
s->y_buffer = av_malloc(s->buffer_size);
@@ -300,8 +304,7 @@ static int xan_decode_frame_type0(AVCodecContext *avctx)
ybuf[j+1] = cur << 1;
last = cur;
}
- if(j < avctx->width)
- ybuf[j] = last << 1;
+ ybuf[j] = last << 1;
prev_buf = ybuf;
ybuf += avctx->width;
@@ -314,8 +317,7 @@ static int xan_decode_frame_type0(AVCodecContext *avctx)
ybuf[j+1] = cur << 1;
last = cur;
}
- if(j < avctx->width)
- ybuf[j] = last << 1;
+ ybuf[j] = last << 1;
prev_buf = ybuf;
ybuf += avctx->width;
}
@@ -375,8 +377,7 @@ static int xan_decode_frame_type1(AVCodecContext *avctx)
ybuf[j+1] = cur;
last = cur;
}
- if(j < avctx->width)
- ybuf[j] = last;
+ ybuf[j] = last;
ybuf += avctx->width;
}