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
(cherry picked from commit 77bb0004bb)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
Anton Khirnov
2013-11-28 10:54:35 +01:00
committed by Luca Barbato
parent 27f60e2b0b
commit d2a065437a

View File

@@ -38,6 +38,7 @@
#include <stdlib.h>
#include <string.h>
#include "libavutil/common.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
@@ -126,6 +127,8 @@ static void rpza_decode_stream(RpzaContext *s)
}
}
n_blocks = FFMIN(n_blocks, total_blocks);
switch (opcode & 0xe0) {
/* Skip blocks */