summaryrefslogtreecommitdiff
path: root/libavcodec/rpza.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-11-28 10:54:35 +0100
committerAnton Khirnov <anton@khirnov.net>2014-02-10 15:22:28 +0100
commit77bb0004bbe18f1498cfecdc68db5f10808b6599 (patch)
tree5534c51ecfbe61d34abe6d0d75b01453224ae047 /libavcodec/rpza.c
parenta46dc49744bdc4f2e31725b63ac8e41f701e4fa1 (diff)
rpza: limit the number of blocks to the total remaining blocks in the frame
Fixes invalid writes. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC:libav-stable@libav.org
Diffstat (limited to 'libavcodec/rpza.c')
-rw-r--r--libavcodec/rpza.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/rpza.c b/libavcodec/rpza.c
index 0efd7f4712..83dde7a9c3 100644
--- a/libavcodec/rpza.c
+++ b/libavcodec/rpza.c
@@ -119,6 +119,8 @@ static void rpza_decode_stream(RpzaContext *s)
}
}
+ n_blocks = FFMIN(n_blocks, total_blocks);
+
switch (opcode & 0xe0) {
/* Skip blocks */