Commit 79798f7c authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/dirac_parser: Fix potential overflows in pointer checks

Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 49b82bc9
...@@ -100,10 +100,12 @@ typedef struct DiracParseUnit { ...@@ -100,10 +100,12 @@ typedef struct DiracParseUnit {
static int unpack_parse_unit(DiracParseUnit *pu, DiracParseContext *pc, static int unpack_parse_unit(DiracParseUnit *pu, DiracParseContext *pc,
int offset) int offset)
{ {
uint8_t *start = pc->buffer + offset; int8_t *start;
uint8_t *end = pc->buffer + pc->index;
if (start < pc->buffer || (start + 13 > end)) if (offset < 0 || pc->index - 13 < offset)
return 0; return 0;
start = pc->buffer + offset;
pu->pu_type = start[4]; pu->pu_type = start[4];
pu->next_pu_offset = AV_RB32(start + 5); pu->next_pu_offset = AV_RB32(start + 5);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment