[FFmpeg-cvslog] rpza: error out on buffer overreads.
Ronald S. Bultje
git at videolan.org
Thu Mar 1 03:20:21 CET 2012
ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Tue Feb 28 17:04:33 2012 -0800| [78e9852a2e3b198ecd69ffa0deab3fa22a8e5378] | committer: Ronald S. Bultje
rpza: error out on buffer overreads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=78e9852a2e3b198ecd69ffa0deab3fa22a8e5378
---
libavcodec/rpza.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/libavcodec/rpza.c b/libavcodec/rpza.c
index 7350ef2..59c3a7b 100644
--- a/libavcodec/rpza.c
+++ b/libavcodec/rpza.c
@@ -183,6 +183,8 @@ static void rpza_decode_stream(RpzaContext *s)
color4[1] |= ((11 * ta + 21 * tb) >> 5);
color4[2] |= ((21 * ta + 11 * tb) >> 5);
+ if (s->size - stream_ptr < n_blocks * 4)
+ return;
while (n_blocks--) {
block_ptr = row_ptr + pixel_ptr;
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
@@ -200,6 +202,8 @@ static void rpza_decode_stream(RpzaContext *s)
/* Fill block with 16 colors */
case 0x00:
+ if (s->size - stream_ptr < 16)
+ return;
block_ptr = row_ptr + pixel_ptr;
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
for (pixel_x = 0; pixel_x < 4; pixel_x++){
More information about the ffmpeg-cvslog
mailing list