[FFmpeg-cvslog] avformat/matroskaenc: Fix potential overflow

Andreas Rheinhardt git at videolan.org
Wed Jan 19 13:54:18 EET 2022


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Jan 16 10:18:34 2022 +0100| [ca168635494276bb7f2f686de07747e7f493e30c] | committer: Andreas Rheinhardt

avformat/matroskaenc: Fix potential overflow

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ca168635494276bb7f2f686de07747e7f493e30c
---

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

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 41b2df7dbf..1dde12a7d9 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -286,7 +286,7 @@ static void put_ebml_uint(AVIOContext *pb, uint32_t elementid, uint64_t val)
 static void put_ebml_sint(AVIOContext *pb, uint32_t elementid, int64_t val)
 {
     int i, bytes = 1;
-    uint64_t tmp = 2*(val < 0 ? val^-1 : val);
+    uint64_t tmp = 2 * (uint64_t)(val < 0 ? val^-1 : val);
 
     while (tmp >>= 8)
         bytes++;



More information about the ffmpeg-cvslog mailing list