File chmlib-CVE-2025-48172.patch of Package chmlib

Index: chmlib-0.40/src/chm_lib.c
===================================================================
--- chmlib-0.40.orig/src/chm_lib.c
+++ chmlib-0.40/src/chm_lib.c
@@ -86,6 +86,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <limits.h>
 /* #include <dmalloc.h> */
 #endif
 
@@ -570,6 +571,11 @@ static int _unmarshal_lzxc_reset_table(u
     if (dest->version != 2)
         return 0;
 
+    if (dest->uncompressed_len > INT_MAX || dest->compressed_len > INT_MAX)
+        return 0;
+    if (dest->block_len == 0 || dest->block_len > INT_MAX)
+        return 0;
+
     return 1;
 }
 
openSUSE Build Service is sponsored by