avformat/mov: Check creation_time for overflow
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 1 Apr 2017 17:18:36 +0000 (19:18 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 14 May 2017 10:20:15 +0000 (12:20 +0200)
Fixes integer overflow
Fixes: 701640

Found-by: Found-by: Thomas Guilbert <tguilbert@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 39ee3ddff87a12e108fc4e0d36f756d0ca080472)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/mov.c

index 12811db..24a76a0 100644 (file)
@@ -1182,6 +1182,12 @@ static void mov_metadata_creation_time(AVDictionary **metadata, int64_t time)
     if (time) {
         if(time >= 2082844800)
             time -= 2082844800;  /* seconds between 1904-01-01 and Epoch */
+
+        if ((int64_t)(time * 1000000ULL) / 1000000 != time) {
+            av_log(NULL, AV_LOG_DEBUG, "creation_time is not representable\n");
+            return;
+        }
+
         avpriv_dict_set_timestamp(metadata, "creation_time", time * 1000000);
     }
 }