[04/10] hls: Avoid integer overflow

Message ID 1375038091-92151-4-git-send-email-martin@martin.st
State Superseded
Headers show

Commit Message

Martin Storsjö July 28, 2013, 7:01 p.m.
From: Michael Niedermayer <michaelni@gmx.at>

---
 libavformat/hls.c      |    2 +-
 libavformat/hlsproto.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Luca Barbato July 28, 2013, 7:56 p.m. | #1
On 28/07/13 21:01, Martin Storsjö wrote:
> From: Michael Niedermayer <michaelni@gmx.at>
> 
> ---
>  libavformat/hls.c      |    2 +-
>  libavformat/hlsproto.c |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 

If we share an header make it a macro constant, otherwise ok.
Martin Storsjö July 28, 2013, 8 p.m. | #2
On Sun, 28 Jul 2013, Luca Barbato wrote:

> On 28/07/13 21:01, Martin Storsjö wrote:
>> From: Michael Niedermayer <michaelni@gmx.at>
>> 
>> ---
>>  libavformat/hls.c      |    2 +-
>>  libavformat/hlsproto.c |    2 +-
>>  2 files changed, 2 insertions(+), 2 deletions(-)
>> 
>
> If we share an header make it a macro constant, otherwise ok.

They don't share headers, and this is the constant for "half a second, in 
microseconds".

// Martin
Luca Barbato July 28, 2013, 8:06 p.m. | #3
On 28/07/13 22:00, Martin Storsjö wrote:
> They don't share headers, and this is the constant for "half a second,
> in microseconds".

Then patch ok.

Patch

diff --git a/libavformat/hls.c b/libavformat/hls.c
index b9b1fea..ef5bb78 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -393,7 +393,7 @@  reload:
             /* If we need to reload the playlist again below (if
              * there's still no more segments), switch to a reload
              * interval of half the target duration. */
-            reload_interval = v->target_duration * 500000;
+            reload_interval = v->target_duration * INT64_C(500000);
         }
         if (v->cur_seq_no < v->start_seq_no) {
             av_log(NULL, AV_LOG_WARNING,
diff --git a/libavformat/hlsproto.c b/libavformat/hlsproto.c
index 72b6c72..21f85c0 100644
--- a/libavformat/hlsproto.c
+++ b/libavformat/hlsproto.c
@@ -280,7 +280,7 @@  retry:
             /* If we need to reload the playlist again below (if
              * there's still no more segments), switch to a reload
              * interval of half the target duration. */
-            reload_interval = s->target_duration * 500000;
+            reload_interval = s->target_duration * INT64_C(500000);
         }
     }
     if (s->cur_seq_no < s->start_seq_no) {