[FFmpeg-devel] [PATCH 05/22] avformat/matroskadec: Use int64_t size

Michael Niedermayer michael at niedermayer.cc
Fri Jul 12 02:33:59 EEST 2024


The length is 64bit that is passed into the functions.
Alternatively the values can be checked before cast

Fixes: CID1604572 Overflowed return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavformat/matroskadec.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index aa28a37da4c..9914838698c 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -989,7 +989,7 @@ static int ebml_read_length(MatroskaDemuxContext *matroska, AVIOContext *pb,
  * Read the next element as an unsigned int.
  * Returns NEEDS_CHECKING unless size == 0.
  */
-static int ebml_read_uint(AVIOContext *pb, int size,
+static int ebml_read_uint(AVIOContext *pb, int64_t size,
                           uint64_t default_value, uint64_t *num)
 {
     int n = 0;
@@ -1010,7 +1010,7 @@ static int ebml_read_uint(AVIOContext *pb, int size,
  * Read the next element as a signed int.
  * Returns NEEDS_CHECKING unless size == 0.
  */
-static int ebml_read_sint(AVIOContext *pb, int size,
+static int ebml_read_sint(AVIOContext *pb, int64_t size,
                           int64_t default_value, int64_t *num)
 {
     int n = 1;
@@ -1033,7 +1033,7 @@ static int ebml_read_sint(AVIOContext *pb, int size,
  * Read the next element as a float.
  * Returns 0 if size == 0, NEEDS_CHECKING or < 0 on obvious failure.
  */
-static int ebml_read_float(AVIOContext *pb, int size,
+static int ebml_read_float(AVIOContext *pb, int64_t size,
                            double default_value, double *num)
 {
     if (size == 0) {
-- 
2.45.2



More information about the ffmpeg-devel mailing list