aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-12-05 17:14:36 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2015-12-06 02:08:26 +0100
commit87dbcf7cd28e4c3b2e17c653b580f19c8566b0ec (patch)
tree0960c177bccf777e4f37a3af33dc468a0223d55a
parent752a6591b2dbc0edcbf19eec8a5ff509e097fbc2 (diff)
downloadffmpeg-87dbcf7cd28e4c3b2e17c653b580f19c8566b0ec.tar.gz
avcodec/dirac_parser: Add basic validity checks for next_pu_offset and prev_pu_offset
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit c7d6ec947c053699950af90f695413a5640b3872) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/dirac_parser.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/dirac_parser.c b/libavcodec/dirac_parser.c
index 12f1a60145..c7c4b697c8 100644
--- a/libavcodec/dirac_parser.c
+++ b/libavcodec/dirac_parser.c
@@ -114,6 +114,15 @@ static int unpack_parse_unit(DiracParseUnit *pu, DiracParseContext *pc,
if (pu->pu_type == 0x10 && pu->next_pu_offset == 0)
pu->next_pu_offset = 13;
+ if (pu->next_pu_offset && pu->next_pu_offset < 13) {
+ av_log(NULL, AV_LOG_ERROR, "next_pu_offset %d is invalid\n", pu->next_pu_offset);
+ return 0;
+ }
+ if (pu->prev_pu_offset && pu->prev_pu_offset < 13) {
+ av_log(NULL, AV_LOG_ERROR, "prev_pu_offset %d is invalid\n", pu->prev_pu_offset);
+ return 0;
+ }
+
return 1;
}