Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-06-14 17:58:20 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2017-06-16 01:21:30 +0300
commit611b35627488a8d0763e75c25ee0875c5b7987dd (patch)
tree98961910542c54f9f7c1cc26a733167c25fdf075 /libavcodec/dnxhd_parser.c
parentb52b398c30a729dda38c0dd5a0cdeef160c4ca54 (diff)
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>
Diffstat (limited to 'libavcodec/dnxhd_parser.c')
-rw-r--r--libavcodec/dnxhd_parser.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libavcodec/dnxhd_parser.c b/libavcodec/dnxhd_parser.c
index d9914121a0..79ca1d6718 100644
--- a/libavcodec/dnxhd_parser.c
+++ b/libavcodec/dnxhd_parser.c
@@ -68,16 +68,18 @@ static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
dctx->w = (state >> 32) & 0xFFFF;
} else if (dctx->cur_byte == 42) {
int cid = (state >> 32) & 0xFFFFFFFF;
+ int remaining;
if (cid <= 0)
continue;
- dctx->remaining = avpriv_dnxhd_get_frame_size(cid);
- if (dctx->remaining <= 0) {
- dctx->remaining = ff_dnxhd_get_hr_frame_size(cid, dctx->w, dctx->h);
- if (dctx->remaining <= 0)
- return dctx->remaining;
+ remaining = avpriv_dnxhd_get_frame_size(cid);
+ if (remaining <= 0) {
+ remaining = ff_dnxhd_get_hr_frame_size(cid, dctx->w, dctx->h);
+ if (remaining <= 0)
+ continue;
}
+ dctx->remaining = remaining;
if (buf_size - i + 47 >= dctx->remaining) {
int remaining = dctx->remaining;