Ok, let's use cast, new patch attached.

On Mon, Jul 30, 2018 at 4:53 PM Michael Niedermayer <mich...@niedermayer.cc>
wrote:

> On Mon, Jul 30, 2018 at 01:49:24PM -0700, Fredrik Hubinette wrote:
> > Is casting a negative integer to unsigned defined behavior?
>
> yes
>
> 6.3.1.3 Signed and unsigned integers
>
> 2 Otherwise, if the new type is unsigned, the value is converted by
> repeatedly adding or
>   subtracting one more than the maximum value that can be represented in
> the new type
>   until the value is in the range of the new type.49)
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> I do not agree with what you have to say, but I'll defend to the death your
> right to say it. -- Voltaire
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
From e8f3a5a4ff9b89b33f4067c7aa735fff9895333e Mon Sep 17 00:00:00 2001
From: Fredrik Hubinette <hu...@google.com>
Date: Mon, 20 Aug 2018 12:59:32 -0700
Subject: [PATCH] avoid undefined integer overflow behavior

---
 libavformat/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index fcd4328587..b0b5e164a6 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2666,7 +2666,7 @@ static void update_stream_timings(AVFormatContext *ic)
                 duration = FFMAX(duration, duration1);
         }
     }
-    if (start_time == INT64_MAX || (start_time > start_time_text && start_time - start_time_text < AV_TIME_BASE))
+    if (start_time == INT64_MAX || (start_time > start_time_text && start_time - (uint64_t)start_time_text < AV_TIME_BASE))
         start_time = start_time_text;
     else if (start_time > start_time_text)
         av_log(ic, AV_LOG_VERBOSE, "Ignoring outlier non primary stream starttime %f\n", start_time_text / (float)AV_TIME_BASE);
-- 
2.18.0.865.gffc8e1a3cd6-goog

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to