[FFmpeg-cvslog] avcodec/c93: Check for block overlap.
Michael Niedermayer
git at videolan.org
Thu Jan 16 02:46:56 CET 2014
ffmpeg | branch: release/1.2 | Michael Niedermayer <michaelni at gmx.at> | Tue Apr 16 16:41:21 2013 +0200| [8ded3738d15c9fb83906a5c1a5a04925130edc1f] | committer: Michael Niedermayer
avcodec/c93: Check for block overlap.
Fixes overlapping memcpy()
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 6b657ac7889738b9ab38924cca4e7c418f6fbc38)
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8ded3738d15c9fb83906a5c1a5a04925130edc1f
---
libavcodec/c93.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/libavcodec/c93.c b/libavcodec/c93.c
index e5f371b..c6358d5 100644
--- a/libavcodec/c93.c
+++ b/libavcodec/c93.c
@@ -175,7 +175,13 @@ static int decode_frame(AVCodecContext *avctx, void *data,
case C93_4X4_FROM_PREV:
for (j = 0; j < 8; j += 4) {
for (i = 0; i < 8; i += 4) {
- offset = bytestream2_get_le16(&gb);
+ int offset = bytestream2_get_le16(&gb);
+ int from_x = offset % WIDTH;
+ int from_y = offset / WIDTH;
+ if (block_type == C93_4X4_FROM_CURR && from_y == y+j &&
+ (FFABS(from_x - x-i) < 4 || FFABS(from_x - x-i) > WIDTH-4)) {
+ return AVERROR_INVALIDDATA;
+ }
if ((ret = copy_block(avctx, &out[j*stride+i],
copy_from, offset, 4, stride)) < 0)
return ret;
More information about the ffmpeg-cvslog
mailing list