[MPlayer-dev-eng] [PATCH 1/6] ebml.c: fix bad length check.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Mon Jan 18 00:00:35 EET 2021


Fixes trac issue #2361.
---
 libmpdemux/ebml.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/libmpdemux/ebml.c b/libmpdemux/ebml.c
index 858811d37..59e2d7299 100644
--- a/libmpdemux/ebml.c
+++ b/libmpdemux/ebml.c
@@ -31,10 +31,6 @@
 #include "libavutil/intfloat.h"


-#ifndef SIZE_MAX
-#define SIZE_MAX ((size_t)-1)
-#endif
-
 /*
  * Read: the element content data ID.
  * Return: the ID.
@@ -214,7 +210,7 @@ char *ebml_read_ascii(stream_t *s, uint64_t *length)
     len = ebml_read_length(s, &l);
     if (len == EBML_UINT_INVALID)
         return NULL;
-    if (len > SIZE_MAX - 1)
+    if (len >= INT_MAX)
         return NULL;
     if (length)
         *length = len + l;
--
2.30.0



More information about the MPlayer-dev-eng mailing list