[FFmpeg-cvslog] avformat/nutdec: Check X in 2nd branch of index reading

Michael Niedermayer git at videolan.org
Mon Jul 20 10:48:09 CEST 2015


ffmpeg | branch: release/2.6 | Michael Niedermayer <michaelni at gmx.at> | Sat May 23 00:23:05 2015 +0200| [bd9313d9f840ea4d96b36547e42014f0fba6cfa8] | committer: Michael Niedermayer

avformat/nutdec: Check X in 2nd branch of index reading

Prevents read of uninitialized variable

Based on patch by: Andreas Cadhalpun <andreas.cadhalpun at googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit ebb0ca3d70465ab6d369a66b2ef43bb059705db8)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bd9313d9f840ea4d96b36547e42014f0fba6cfa8
---

 libavformat/nutdec.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index bb17e90..596dd5c 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -706,6 +706,10 @@ static int find_and_decode_index(NUTContext *nut)
                     has_keyframe[n++] = flag;
                 has_keyframe[n++] = !flag;
             } else {
+                if (x <= 1) {
+                    av_log(s, AV_LOG_ERROR, "index: x %"PRIu64" is invalid\n", x);
+                    goto fail;
+                }
                 while (x != 1) {
                     if (n >= syncpoint_count + 1) {
                         av_log(s, AV_LOG_ERROR, "index overflow B\n");



More information about the ffmpeg-cvslog mailing list