From fd0f45e58b010c0d7049914a392c3e96a2223107 Mon Sep 17 00:00:00 2001
From: Roman Shaposhnik <roman@shaposhnik.org>
Date: Mon, 22 Sep 2003 18:17:45 +0000
Subject: [PATCH]    * fix for integer overflow

Originally committed as revision 2297 to svn://svn.ffmpeg.org/ffmpeg/trunk
---
 ffmpeg.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 34958abee3f..9784b523514 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1125,11 +1125,11 @@ static int av_encode(AVFormatContext **output_files,
             switch (ist->st->codec.codec_type) {
             case CODEC_TYPE_AUDIO:
                 av_frac_init(&ist->next_pts, 
-                             0, 0, is->pts_num * ist->st->codec.sample_rate);
+                             0, 0, (uint64_t)is->pts_num * ist->st->codec.sample_rate);
                 break;
             case CODEC_TYPE_VIDEO:
                 av_frac_init(&ist->next_pts, 
-                             0, 0, is->pts_num * ist->st->codec.frame_rate);
+                             0, 0, (uint64_t)is->pts_num * ist->st->codec.frame_rate);
                 break;
             default:
                 break;
@@ -1275,7 +1275,7 @@ static int av_encode(AVFormatContext **output_files,
                     }
                     data_buf = (uint8_t *)samples;
 		    av_frac_add(&ist->next_pts, 
-			        is->pts_den * data_size / (2 * ist->st->codec.channels));
+			        (uint64_t)is->pts_den * data_size / (2 * ist->st->codec.channels));
                     break;
                 case CODEC_TYPE_VIDEO:
                     {
@@ -1300,7 +1300,7 @@ static int av_encode(AVFormatContext **output_files,
                             continue;
                         }
                         av_frac_add(&ist->next_pts, 
-			            is->pts_den * ist->st->codec.frame_rate_base);          
+			            (uint64_t)is->pts_den * ist->st->codec.frame_rate_base);          
                     }
                     break;
                 default:
-- 
GitLab