Skip to content

Commit 0a709e2

Browse files
committed
avcodec/dnxhd_parser: Do not return invalid value from dnxhd_find_frame_end() on error
Fixes: Null pointer dereference Fixes: CVE-2017-9608 Found-by: Yihan Lian Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 611b356) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
1 parent 10d8213 commit 0a709e2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Diff for: libavcodec/dnxhd_parser.c

+7-5
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,18 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
8181
dctx->w = (state >> 32) & 0xFFFF;
8282
} else if (dctx->cur_byte == 42) {
8383
int cid = (state >> 32) & 0xFFFFFFFF;
84+
int remaining;
8485

8586
if (cid <= 0)
8687
continue;
8788

88-
dctx->remaining = avpriv_dnxhd_get_frame_size(cid);
89-
if (dctx->remaining <= 0) {
90-
dctx->remaining = dnxhd_get_hr_frame_size(cid, dctx->w, dctx->h);
91-
if (dctx->remaining <= 0)
92-
return dctx->remaining;
89+
remaining = avpriv_dnxhd_get_frame_size(cid);
90+
if (remaining <= 0) {
91+
remaining = dnxhd_get_hr_frame_size(cid, dctx->w, dctx->h);
92+
if (remaining <= 0)
93+
continue;
9394
}
95+
dctx->remaining = remaining;
9496
if (buf_size - i + 47 >= dctx->remaining) {
9597
int remaining = dctx->remaining;
9698

0 commit comments

Comments
 (0)