diff mbox

[FFmpeg-devel,3/3] avformat/mov: Check creation_time for overflow

Message ID 20170401171836.32701-3-michael@niedermayer.cc
State Accepted
Commit 39ee3ddff87a12e108fc4e0d36f756d0ca080472
Headers show

Commit Message

Michael Niedermayer April 1, 2017, 5:18 p.m. UTC
Fixes integer overflow
Fixes: 701640

Found-by: Found-by: Thomas Guilbert <tguilbert@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/mov.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Michael Niedermayer April 3, 2017, 10:40 p.m. UTC | #1
On Sat, Apr 01, 2017 at 07:18:36PM +0200, Michael Niedermayer wrote:
> Fixes integer overflow
> Fixes: 701640
> 
> Found-by: Found-by: Thomas Guilbert <tguilbert@google.com>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/mov.c | 6 ++++++
>  1 file changed, 6 insertions(+)

applied

[...]
diff mbox

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index c9d076ee21..9c1c36c4be 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1186,6 +1186,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);
     }
 }