avformat/oggparsedaala: Do not leave an invalid value in gpshift
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 1 Apr 2017 17:18:35 +0000 (19:18 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 1 Apr 2017 20:09:23 +0000 (22:09 +0200)
Fixes: undefined behavior
Fixes: 702974

Found-by: Thomas Guilbert <tguilbert@google.com>
Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/oggparsedaala.c

index ce65b2b..a373b41 100644 (file)
@@ -126,6 +126,7 @@ static int daala_header(AVFormatContext *s, int idx)
         if (hdr->gpshift >= 32) {
             av_log(s, AV_LOG_ERROR, "Too large gpshift %d (>= 32).\n",
                    hdr->gpshift);
+            hdr->gpshift = 0;
             return AVERROR_INVALIDDATA;
         }
         hdr->gpmask  = (1U << hdr->gpshift) - 1;