Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package cabextract for openSUSE:Factory 
checked in at 2026-11-23 12:24:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/cabextract (Old)
 and      /work/SRC/openSUSE:Factory/.cabextract.new.1340718 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "cabextract"

Mon Nov 23 12:24:50 2026 rev:30 rq:1399755 version:1.12

Changes:
--------
--- /work/SRC/openSUSE:Factory/cabextract/cabextract.changes    2023-03-08 
14:53:32.238991244 +0100
+++ /work/SRC/openSUSE:Factory/.cabextract.new.1340718/cabextract.changes       
2026-11-23 12:29:29.566082477 +0100
@@ -1,0 +2,26 @@
+Thu Nov 12 16:23:39 UTC 2026 - Martin Hauke <[email protected]>
+
+- Update to version 1.12
+  Changes
+  * cabextract --fix now finds any "hidden" file entries in a CAB
+    file. There are two ways to look for file entries, normally
+    they point to the same place. cabextract --fix looks in both
+    places if they differ. If there appears to be any hidden files,
+    cabextract prints "WARNING; atypical files offset in header"
+  * cabextract now prints file headers warnings for all the regular
+    cabinets listed on the command line.
+  Security Fixes:
+  * An LZX uncompressed block header with invalid R0/R1/R2 values
+    followed by a verbatim/aligned block referencing them can make
+    cabextract write up to 2GB past the end of its history window.
+  * CAB sets where the first mergeable file has an invalid filename
+    (blank or over 256 chars), and salvage mode is enabled, causes
+    cabd_can_merge_folders to read already-freed memory.
+  * CAB MS-ZIP and Quantum match offsets greater than the number of
+    bytes already decoded makes cabextract read uninitialised memory
+    from its history window and write it as output.
+  * CAB files can "hide" entries (which other tools might see) using
+    an atypical FileOffset value. cabextract writes a warning on
+    finding this discrepancy and --fix finds the "hidden" entries.
+
+-------------------------------------------------------------------

Old:
----
  cabextract-1.11.tar.gz

New:
----
  cabextract-1.12.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ cabextract.spec ++++++
--- /var/tmp/diff_new_pack.7jmX1u/_old  2026-11-23 12:29:31.081146258 +0100
+++ /var/tmp/diff_new_pack.7jmX1u/_new  2026-11-23 12:29:31.085146426 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package cabextract
 #
-# Copyright (c) 2023 SUSE LLC
+# Copyright (c) 2026 SUSE LLC and contributors
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,15 +17,16 @@
 
 
 Name:           cabextract
-Version:        1.11
+Version:        1.12
 Release:        0
 Summary:        A Program to Extract Microsoft Cabinet Files
 License:        GPL-3.0-or-later
 Group:          System/Console
+#Git-Clone:     https://github.com/kyz/libmspack.git
 URL:            https://www.cabextract.org.uk/
 Source:         https://www.cabextract.org.uk/%{name}-%{version}.tar.gz
 BuildRequires:  pkgconfig
-BuildRequires:  pkgconfig(libmspack) >= 0.8
+BuildRequires:  pkgconfig(libmspack) >= 0.12
 
 %description
 Cabinet (.CAB) files are a form of archive, which Microsoft uses to

++++++ cabextract-1.11.tar.gz -> cabextract-1.12.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabextract-1.11/ChangeLog 
new/cabextract-1.12/ChangeLog
--- old/cabextract-1.11/ChangeLog       2023-02-19 13:43:00.000000000 +0100
+++ new/cabextract-1.12/ChangeLog       2026-09-23 14:35:28.000000000 +0200
@@ -1,3 +1,24 @@
+2026-09-23  Stuart Caie <[email protected]>
+
+       * test/hidden-files.test: add a test for cabextract warning about
+       atypical files, and finding them in "-f" mode. See the libmspack
+       changelog (2026-03-31) for details, and again thanks to
+       Yulia Siniakovich for raising the issue.
+
+2026-07-21  Stuart Caie <[email protected]>
+
+       * md5.c, src/cabextract.c: add explicit casts and integer suffixes
+       to make UBSan happy. Testing with clang-22 -fsanitize=undefined
+       -fsanitize=implicit-conversion -fsanitize=local-bounds brings up more
+       implicit type conversions and shifting 1s into the MSB of signed
+       integers. Switching to explicit casts changes this from undefined
+       behaviour to implementation-specific behaviour. See my comments in
+       the libmspack changelog entries for what I think of this. Thank you
+       to "0daydreamerr" who sent me a report on this.
+
+       * test/md5.c: as I'm changing this file, I'll add a requested line to
+       quell a coverity warning: https://github.com/kyz/libmspack/pull/50
+
 2023-02-19  Stuart Caie <[email protected]>
 
        * ensure_filepath(): had wrong logic, for the archive-controlled
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabextract-1.11/Makefile.am 
new/cabextract-1.12/Makefile.am
--- old/cabextract-1.11/Makefile.am     2023-02-19 13:43:57.000000000 +0100
+++ new/cabextract-1.12/Makefile.am     2026-11-12 06:50:14.000000000 +0100
@@ -10,8 +10,8 @@
 
 TESTS =                 test/bugs.test test/case-ascii.test 
test/case-utf8.test \
                         test/dir.test test/dirwalk-vulns.test 
test/encoding.test \
-                        test/mixed.test test/search.test test/simple.test \
-                        test/split.test test/utf8-stresstest.test \
+                        test/hidden-files.test test/mixed.test 
test/search.test \
+                        test/simple.test test/split.test 
test/utf8-stresstest.test \
                         test/symlinks.test
 
 EXTRA_DIST =            cabextract.spec \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabextract-1.11/Makefile.in 
new/cabextract-1.12/Makefile.in
--- old/cabextract-1.11/Makefile.in     2023-02-24 13:03:19.000000000 +0100
+++ new/cabextract-1.12/Makefile.in     2026-11-12 06:53:28.000000000 +0100
@@ -538,8 +538,8 @@
 
 TESTS = test/bugs.test test/case-ascii.test test/case-utf8.test \
                         test/dir.test test/dirwalk-vulns.test 
test/encoding.test \
-                        test/mixed.test test/search.test test/simple.test \
-                        test/split.test test/utf8-stresstest.test \
+                        test/hidden-files.test test/mixed.test 
test/search.test \
+                        test/simple.test test/split.test 
test/utf8-stresstest.test \
                         test/symlinks.test
 
 EXTRA_DIST = cabextract.spec \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabextract-1.11/NEWS new/cabextract-1.12/NEWS
--- old/cabextract-1.11/NEWS    2023-02-24 12:40:23.000000000 +0100
+++ new/cabextract-1.12/NEWS    2026-09-23 14:40:13.000000000 +0200
@@ -1,3 +1,14 @@
+New in 1.12
+* cabextract -f now finds "hidden" files. There are two ways to look in
+  cabinets for files, which normally have the same results, but don't have
+  to. 7-Zip and Microsoft extract.exe find "hidden" files but not "normal"
+  files, while cabextract and Microsoft expand.exe find "normal" files but
+  not "hidden" files. cabextract -f now finds both "hidden" and "normal"
+  files, if they differ.
+* cabextract now prints more warning and error messages for normal cab files
+  listed on the command line. For example, it now prints "WARNING; atypical
+  files offset in header" if cabextract -f might find "hidden" files
+
 New in 1.11
 * Fixed bug in creating directories given in archives, e.g. extracting file
   "a/b.c" from a cab file wouldn't create directory "a" (broken in 1.10)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabextract-1.11/README new/cabextract-1.12/README
--- old/cabextract-1.11/README  2023-02-24 12:38:48.000000000 +0100
+++ new/cabextract-1.12/README  2026-11-12 06:43:50.000000000 +0100
@@ -1,4 +1,4 @@
-cabextract 1.11 - a program to extract Microsoft Cabinet files.
+cabextract 1.12 - a program to extract Microsoft Cabinet files.
 (C) 2000-2023 Stuart Caie <[email protected]>
 This is free software with ABSOLUTELY NO WARRANTY.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabextract-1.11/aclocal.m4 
new/cabextract-1.12/aclocal.m4
--- old/cabextract-1.11/aclocal.m4      2023-02-24 13:03:17.000000000 +0100
+++ new/cabextract-1.12/aclocal.m4      2026-11-12 06:53:26.000000000 +0100
@@ -2276,8 +2276,8 @@
 changequote([,])dnl
 ])
 
-# pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
-# serial 11 (pkg-config-0.29.1)
+# pkg.m4 - Macros to locate and use pkg-config.   -*- Autoconf -*-
+# serial 12 (pkg-config-0.29.2)
 
 dnl Copyright © 2004 Scott James Remnant <[email protected]>.
 dnl Copyright © 2012-2015 Dan Nicholson <[email protected]>
@@ -2319,7 +2319,7 @@
 dnl See the "Since" comment for each macro you use to see what version
 dnl of the macros you require.
 m4_defun([PKG_PREREQ],
-[m4_define([PKG_MACROS_VERSION], [0.29.1])
+[m4_define([PKG_MACROS_VERSION], [0.29.2])
 m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
     [m4_fatal([pkg.m4 version $1 or higher is required but 
]PKG_MACROS_VERSION[ found])])
 ])dnl PKG_PREREQ
@@ -2364,7 +2364,7 @@
 dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
 dnl
 dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
-dnl only at the first occurence in configure.ac, so if the first place
+dnl only at the first occurrence in configure.ac, so if the first place
 dnl it's called might be skipped (such as if it is within an "if", you
 dnl have to call PKG_CHECK_EXISTS manually
 AC_DEFUN([PKG_CHECK_EXISTS],
@@ -2420,7 +2420,7 @@
 AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
 
 pkg_failed=no
-AC_MSG_CHECKING([for $1])
+AC_MSG_CHECKING([for $2])
 
 _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
 _PKG_CONFIG([$1][_LIBS], [libs], [$2])
@@ -2430,17 +2430,17 @@
 See the pkg-config man page for more details.])
 
 if test $pkg_failed = yes; then
-       AC_MSG_RESULT([no])
+        AC_MSG_RESULT([no])
         _PKG_SHORT_ERRORS_SUPPORTED
         if test $_pkg_short_errors_supported = yes; then
-               $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors 
--cflags --libs "$2" 2>&1`
-        else 
-               $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs 
"$2" 2>&1`
+                $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors 
--cflags --libs "$2" 2>&1`
+        else
+                $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs 
"$2" 2>&1`
         fi
-       # Put the nasty error message in config.log where it belongs
-       echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+        # Put the nasty error message in config.log where it belongs
+        echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
 
-       m4_default([$4], [AC_MSG_ERROR(
+        m4_default([$4], [AC_MSG_ERROR(
 [Package requirements ($2) were not met:
 
 $$1_PKG_ERRORS
@@ -2451,8 +2451,8 @@
 _PKG_TEXT])[]dnl
         ])
 elif test $pkg_failed = untried; then
-       AC_MSG_RESULT([no])
-       m4_default([$4], [AC_MSG_FAILURE(
+        AC_MSG_RESULT([no])
+        m4_default([$4], [AC_MSG_FAILURE(
 [The pkg-config script could not be found or is too old.  Make sure it
 is in your PATH or set the PKG_CONFIG environment variable to the full
 path to pkg-config.
@@ -2462,10 +2462,10 @@
 To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
         ])
 else
-       $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
-       $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+        $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+        $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
         AC_MSG_RESULT([yes])
-       $3
+        $3
 fi[]dnl
 ])dnl PKG_CHECK_MODULES
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabextract-1.11/cabextract.spec 
new/cabextract-1.12/cabextract.spec
--- old/cabextract-1.11/cabextract.spec 2023-02-24 13:03:48.000000000 +0100
+++ new/cabextract-1.12/cabextract.spec 2026-11-12 06:54:04.000000000 +0100
@@ -1,6 +1,6 @@
 Summary: A program to extract Microsoft Cabinet files
 Name: cabextract
-Version: 1.11
+Version: 1.12
 Release: 1
 License: GPL
 Group: Applications/Archiving
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabextract-1.11/configure 
new/cabextract-1.12/configure
--- old/cabextract-1.11/configure       2023-02-24 13:03:18.000000000 +0100
+++ new/cabextract-1.12/configure       2026-11-12 06:53:27.000000000 +0100
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for cabextract 1.11.
+# Generated by GNU Autoconf 2.71 for cabextract 1.12.
 #
 # Report bugs to <[email protected]>.
 #
@@ -611,8 +611,8 @@
 # Identity of this package.
 PACKAGE_NAME='cabextract'
 PACKAGE_TARNAME='cabextract'
-PACKAGE_VERSION='1.11'
-PACKAGE_STRING='cabextract 1.11'
+PACKAGE_VERSION='1.12'
+PACKAGE_STRING='cabextract 1.12'
 PACKAGE_BUGREPORT='[email protected]'
 PACKAGE_URL=''
 
@@ -1337,7 +1337,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures cabextract 1.11 to adapt to many kinds of systems.
+\`configure' configures cabextract 1.12 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1408,7 +1408,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of cabextract 1.11:";;
+     short | recursive ) echo "Configuration of cabextract 1.12:";;
    esac
   cat <<\_ACEOF
 
@@ -1520,7 +1520,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-cabextract configure 1.11
+cabextract configure 1.12
 generated by GNU Autoconf 2.71
 
 Copyright (C) 2021 Free Software Foundation, Inc.
@@ -2117,7 +2117,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by cabextract $as_me 1.11, which was
+It was created by cabextract $as_me 1.12, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   $ $0$ac_configure_args_raw
@@ -3390,7 +3390,7 @@
 
 # Define the identity of the package.
  PACKAGE='cabextract'
- VERSION='1.11'
+ VERSION='1.12'
 
 
 printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -8314,8 +8314,8 @@
 fi
 
 pkg_failed=no
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libmspack" >&5
-printf %s "checking for libmspack... " >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libmspack >= 
0.8alpha" >&5
+printf %s "checking for libmspack >= 0.8alpha... " >&6; }
 
 if test -n "$libmspack_CFLAGS"; then
     pkg_cv_libmspack_CFLAGS="$libmspack_CFLAGS"
@@ -8355,7 +8355,7 @@
 
 
 if test $pkg_failed = yes; then
-       { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+        { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
 printf "%s\n" "no" >&6; }
 
 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@@ -8364,14 +8364,14 @@
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-               libmspack_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors 
--cflags --libs "libmspack >= 0.8alpha" 2>&1`
+                libmspack_PKG_ERRORS=`$PKG_CONFIG --short-errors 
--print-errors --cflags --libs "libmspack >= 0.8alpha" 2>&1`
         else
-               libmspack_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags 
--libs "libmspack >= 0.8alpha" 2>&1`
+                libmspack_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags 
--libs "libmspack >= 0.8alpha" 2>&1`
         fi
-       # Put the nasty error message in config.log where it belongs
-       echo "$libmspack_PKG_ERRORS" >&5
+        # Put the nasty error message in config.log where it belongs
+        echo "$libmspack_PKG_ERRORS" >&5
 
-       as_fn_error $? "Package requirements (libmspack >= 0.8alpha) were not 
met:
+        as_fn_error $? "Package requirements (libmspack >= 0.8alpha) were not 
met:
 
 $libmspack_PKG_ERRORS
 
@@ -8382,9 +8382,9 @@
 and libmspack_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details." "$LINENO" 5
 elif test $pkg_failed = untried; then
-       { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+        { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
 printf "%s\n" "no" >&6; }
-       { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" 
>&5
+        { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" 
>&5
 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "The pkg-config script could not be found or is too old.  Make 
sure it
 is in your PATH or set the PKG_CONFIG environment variable to the full
@@ -8397,8 +8397,8 @@
 To get pkg-config, see <http://pkg-config.freedesktop.org/>.
 See \`config.log' for more details" "$LINENO" 5; }
 else
-       libmspack_CFLAGS=$pkg_cv_libmspack_CFLAGS
-       libmspack_LIBS=$pkg_cv_libmspack_LIBS
+        libmspack_CFLAGS=$pkg_cv_libmspack_CFLAGS
+        libmspack_LIBS=$pkg_cv_libmspack_LIBS
         { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 printf "%s\n" "yes" >&6; }
 
@@ -8996,7 +8996,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by cabextract $as_me 1.11, which was
+This file was extended by cabextract $as_me 1.12, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -9068,7 +9068,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config='$ac_cs_config_escaped'
 ac_cs_version="\\
-cabextract config.status 1.11
+cabextract config.status 1.12
 configured by $0, generated by GNU Autoconf 2.71,
   with options \\"\$ac_cs_config\\"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabextract-1.11/configure.ac 
new/cabextract-1.12/configure.ac
--- old/cabextract-1.11/configure.ac    2023-02-24 12:39:15.000000000 +0100
+++ new/cabextract-1.12/configure.ac    2026-11-12 06:43:44.000000000 +0100
@@ -1,7 +1,7 @@
 # -*- Autoconf -*-
 # Process this file with autoconf to produce a configure script.
 AC_PREREQ([2.69])
-AC_INIT([cabextract],[1.11],[[email protected]])
+AC_INIT([cabextract],[1.12],[[email protected]])
 AM_INIT_AUTOMAKE
 AC_CONFIG_SRCDIR([src/cabextract.c])
 AC_CONFIG_HEADERS([config.h])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabextract-1.11/md5.c new/cabextract-1.12/md5.c
--- old/cabextract-1.11/md5.c   2018-11-05 12:59:11.000000000 +0100
+++ new/cabextract-1.12/md5.c   2026-07-21 14:22:49.000000000 +0200
@@ -227,11 +227,11 @@
 
       if (ctx->buflen > 64)
         {
-          md5_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
+          md5_process_block (ctx->buffer, ctx->buflen & ~63U, ctx);
 
           ctx->buflen &= 63;
           /* The regions in the following copy operation cannot overlap.  */
-          memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63],
+          memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63U],
                   ctx->buflen);
         }
 
@@ -261,8 +261,8 @@
       else
 #endif
         {
-          md5_process_block (buffer, len & ~63, ctx);
-          buffer = (const char *) buffer + (len & ~63);
+          md5_process_block (buffer, len & ~63U, ctx);
+          buffer = (const char *) buffer + (len & ~63U);
           len &= 63;
         }
     }
@@ -278,6 +278,7 @@
         {
           md5_process_block (ctx->buffer, 64, ctx);
           left_over -= 64;
+          /* coverity[overlapping_buffer] */
           memcpy (ctx->buffer, &ctx->buffer[64], left_over);
         }
       ctx->buflen = left_over;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabextract-1.11/mspack/ChangeLog 
new/cabextract-1.12/mspack/ChangeLog
--- old/cabextract-1.11/mspack/ChangeLog        2023-02-13 00:59:28.000000000 
+0100
+++ new/cabextract-1.12/mspack/ChangeLog        2026-11-11 06:51:39.000000000 
+0100
@@ -1,3 +1,178 @@
+2026-11-11  Stuart Caie <[email protected]>
+
+       * test/chminfo.c: add various guards to stop out-of-bounds reads
+       when reading CHM files with unusual structure sizes.
+       Thanks to quchenxuan23 for the report.
+
+2026-11-11  Stuart Caie <[email protected]>
+
+       * cabd_read_files(): Don't set merge_next/merge_prev if the file
+       is skipped, which happens if salvage mode is enabled and the file's
+       filename is blank or overlong. Otherwise, cabd_can_merge_folders()
+       will read from the skipped file's freed memory when comparing file
+       lists, which typically crashes.
+
+       Thanks to Nguyen Duy Hung (Hugnd-UIT) for the report.
+
+       * cabd_read_files(): now rejects cabs for having file folder index
+       0xFFFF ("continued previous and next"), but more than one folder.
+
+2026-11-11  Stuart Caie <[email protected]>
+
+       * cabd_read_string(): seek to the byte after a string if it's
+        null-terminated but empty (when it's not allowed to be), so that
+        salvage mode can continue reading if that was the only problem.
+
+2026-10-25  Stuart Caie <[email protected]>
+
+       * read_off64(): reject any CHM files with negative off64 values.
+       Thanks to StateCtrl Inc. for reporting it.
+
+2026-10-25  Stuart Caie <[email protected]>
+
+       * cabd_append(), cabd_prepend(): guard against the programmer
+       appending/prepending a search() result rather than an open() result
+       and trying to merge two parts of the same cabinet together, which
+       then causes problems freeing memory when closing the cabinet.
+
+       This was already an incorrect use of the API, which says the
+       cabinets being merged must span "more than one physical cabinet
+       file on disk", but I've added an even more explicit statement
+       that prevcab/nextcab must come from open() and not search().
+
+       Thanks to Hyunwoo Lee for reporting this.
+
+2026-09-24  Stuart Caie <[email protected]>
+
+       * lzxd_decompress(): you could get an overlong match_offset into
+       R0/R1/R2 using an uncompressed block, then reference it in a match
+       in the following verbatim/aligned block. If the value is over
+       2^31 + window_posn, that makes "j" negative, which makes the match
+       length "i" longer by up to 2GB, which means copying the match will
+       overwrite up to ~2GB past the end of the window.
+       I added a check against j < 0, but also now fail decompression for
+       overlong R0/R1/R2 values in an uncompressed block header.
+
+2026-09-23  Stuart Caie <[email protected]>
+
+       * mszipd_init(), qtmd_decompress(): prevent overlong match offsets
+       reading the decompression window's uninitialised memory. Already
+       prevented in lzxd_decompress(), and SZDD/KWAJ windows have to be
+       pre-initialised. For Quantum, return an error as soon as an
+       overlong match offset is found, while for MSZIP, pre-initialise
+       the window with zeroes rather than fail decompression, to allow
+       decoding to continue in case it yields more data in salvage mode.
+
+       Thanks to Alexandru-Ionut Jipa for reporting the bug.
+
+2026-08-30  Stuart Caie <[email protected]>
+
+       * chmd_fast_find(): reject infinite loops. There is now a limit on
+       how many chunks can be searched; enough to read every chunk once,
+       but no more than that. This means an infinite loop in PMGI or PMGL
+       chunks is no longer possible.
+
+       Thanks to Sumit Chakraborty for reporting the bug and developing
+       example CHM files.
+
+2026-08-29  Stuart Caie <[email protected]>
+
+       * build_decode_table(): add overflow check while allocating entries.
+       For example, an abnormal length on the last symbol could write up to
+       14 entries (56 bytes) beyond the end of the table. Fortunately, all
+       tables are followed by other tables or buffers, so this doesn't write
+       beyond any allocated structure... but it's still a bug worth fixing.
+
+       Thanks to Sumit Chakraborty for finding the bug and providing
+       a detailed report and examples.
+
+2026-08-29  Stuart Caie <[email protected]>
+
+       * lzx.h: correctly size MAINTREE_table. It should be 10304 entries,
+       not 9248, as (1<<nbits) < (2*nsyms). It is 2112 bytes too small.
+
+       It has been wrong since adding OAB and LZX DELTA support in 2013.
+       LZX_MAINTREE_MAXSYMBOLS grew from 256+8*50 to 256+8*290 for more
+       position slots, but table size calculation wasn't changed.
+
+       It isn't an issue with CAB or CHM use of LZX, but unpacking an
+       OAB file with 32MB window size will write beyond MAINTREE_table
+       into the neighbouring LENGTH_table, and then be overwritten as
+       LENGTH_tree is built. Ultimately the file will fail to decode.
+       It doesn't write outwith struct lzxd_stream.
+
+       Thanks to Sumit Chakraborty for finding the bug and providing
+       a detailed report and examples.
+
+2026-07-21  Stuart Caie <[email protected]>
+
+       * kwajd.c, lzxd.c, oabd.c, qtmd.c, test/md5.c: add explicit casts
+       and integer suffixes to make UBSan happy. Testing with clang-22
+       -fsanitize=undefined -fsanitize=implicit-conversion 
-fsanitize=local-bounds
+       brings up more implicit type conversions and shifting 1s into the MSB of
+       signed integers. Switching to explicit casts changes this from undefined
+       behaviour to implementation-specific behaviour. See my comment in past
+       entries for what I think of this.  Thank you to "0daydreamerr" who sent
+       me a report on this, having tested with clang 21.
+
+       * test/md5.c: as I'm changing this file, I'll add a requested line to
+       quell a coverity warning: https://github.com/kyz/libmspack/pull/50
+
+2026-06-15  Stuart Caie <[email protected]>
+
+       * kwajd_read_headers(): initialise pointers before returning any error,
+       otherwise kwajd_close() calls mspack_system.free() with uninitialised
+       pointers, which is undefined behaviour for the default system's free().
+       Thank you to Yukimura Aneha for the report, example files and patch!
+
+2026-04-22  Stuart Caie <[email protected]>
+
+       * cabd_read_headers(): fixed the new salvage mode logic. It would
+       create an infinite loop of files if the typical location had files
+       and the atypical location had none. It also merged errors wrongly.
+       Thanks to Alexandru Hossu for a detailed bug report and example files.
+
+2026-04-22  Stuart Caie <[email protected]>
+
+       * cabd_read_headers(): if salvage mode finds any file entries,
+        suppress any errors, so the salvaged file entries can be returned.
+
+2026-04-22  Stuart Caie <[email protected]>
+
+       * cabd.c: add intermediary wrapper functions to placate UBSan, which
+       complains of calling a function like int foo(struct foo*, off_t)
+       through a pointer like (int (*)(void *, off_t))
+
+       The rationale is apparently C11 6.3.2.3 "If a converted pointer is used
+       to call a function whose type is not compatible with the referenced
+       type, the behavior is undefined." coupled with 6.2.5 part 28:
+       "A pointer to void shall have the same representation and alignment
+       requirements as a pointer to a character type. [...] All pointers to
+       structure types shall have the same representation and alignment
+       requirements as each other. [...] Pointers to other types need not
+       have the same representation or alignment requirements."
+
+       So because void* "need not" have the same representation as struct*,
+       it's undefined, but explicitly casting struct* to void* and vice-versa
+       is fine, provided you do it to the arguments instead of the function?
+
+2026-04-02  Stuart Caie <[email protected]>
+
+       * cabd_find(): let cabd_read_headers() print warnings if caboff == 0.
+       libmspack is meant to print warnings when parsing cab headers, and
+       if you do cabd->open() then you get that. But if you do cab->search()
+       it's speculatively parsing any vaguely matching data so it suppresses
+       warnings... and doesn't parse again to print the warnings! As a
+       compromise, it will now print warnings if it finds a cabinet at
+       offset 0.
+
+2026-03-31  Stuart Caie <[email protected]>
+
+       * cabd_read_headers(): if the header's file offset differs from the
+       typical value, and we are in salvage mode, try reading files from
+       that file offset as well. Thanks to Yulia Siniakovich for raising
+       the issue and supplying a patch.
+
 2023-02-12  Stuart Caie <[email protected]>
 
        * chmd.c: add a default tolower() if MSPACK_NO_DEFAULT_SYSTEM is set.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabextract-1.11/mspack/cabd.c 
new/cabextract-1.12/mspack/cabd.c
--- old/cabextract-1.11/mspack/cabd.c   2023-02-05 22:37:54.000000000 +0100
+++ new/cabextract-1.12/mspack/cabd.c   2026-11-10 23:19:53.000000000 +0100
@@ -78,6 +78,9 @@
 static char *cabd_read_string(
   struct mspack_system *sys, struct mspack_file *fh, int permit_empty,
   int *error);
+static int cabd_read_files(
+  struct mspack_system *sys, struct mspack_file *fh,
+  struct mscabd_cabinet_p *cab, int num_folders, int num_files, int salvage);
 
 static struct mscabd_cabinet *cabd_search(
   struct mscab_decompressor *base, const char *filename);
@@ -93,7 +96,7 @@
   struct mscab_decompressor *base, struct mscabd_cabinet *cab,
   struct mscabd_cabinet *nextcab);
 static int cabd_merge(
-  struct mscab_decompressor *base, struct mscabd_cabinet *lcab,
+  struct mscab_decompressor_p *base, struct mscabd_cabinet *lcab,
   struct mscabd_cabinet *rcab);
 static int cabd_can_merge_folders(
   struct mspack_system *sys, struct mscabd_folder_p *lfol,
@@ -119,8 +122,14 @@
   struct mspack_system *sys, struct mspack_file *in, struct mspack_file *out,
   int bufsize);
 
+static int mszipd_decompress_wrapper(
+  void *state, off_t bytes);
+static int lzxd_decompress_wrapper(
+  void *state, off_t bytes);
+static int qtmd_decompress_wrapper(
+  void *state, off_t bytes);
 static int noned_decompress(
-  struct noned_state *s, off_t bytes);
+  void *state, off_t bytes);
 static void noned_free(
   struct noned_state *state);
 
@@ -311,10 +320,10 @@
                              struct mscabd_cabinet_p *cab,
                              off_t offset, int salvage, int quiet)
 {
-  int num_folders, num_files, folder_resv, i, x, err, fidx;
+  int num_folders, num_files, folder_resv, i, err;
   struct mscabd_folder_p *fol, *linkfol = NULL;
-  struct mscabd_file *file, *linkfile = NULL;
   unsigned char buf[64];
+  off_t cffile_offset, cfhead_file_offset;
 
   /* initialise pointers */
   cab->base.next     = NULL;
@@ -346,6 +355,9 @@
   cab->base.set_id    = EndGetI16(&buf[cfhead_SetID]);
   cab->base.set_index = EndGetI16(&buf[cfhead_CabinetIndex]);
 
+  /* get the offset of the first CFFILE entry */
+  cfhead_file_offset = (off_t) EndGetI32(&buf[cfhead_FileOffset]);
+
   /* get the number of folders */
   num_folders = EndGetI16(&buf[cfhead_NumFolders]);
   if (num_folders == 0) {
@@ -439,7 +451,112 @@
     linkfol = fol;
   }
 
+  /* save the typical offset of the first CFFILE entry, which is
+   * immediately after the last CFFOLDER */
+  cffile_offset = sys->tell(fh) - cab->base.base_offset;
+
   /* read files */
+  err = cabd_read_files(sys, fh, cab, num_folders, num_files, salvage);
+
+  /* if the header claimed file offset is not the typical value */
+  if (cffile_offset != cfhead_file_offset) {
+    if (!quiet) sys->message(fh, "WARNING; atypical files offset in header");
+
+    /* read files from the header file offset in the salvage mode */
+    if (salvage && cfhead_file_offset < (off_t) cab->base.length) {
+      if (!sys->seek(fh, cfhead_file_offset + cab->base.base_offset, 
MSPACK_SYS_SEEK_START)) {
+        /* save the existing list of files (if any), they are overwritten */
+        struct mscabd_file *f1 = cab->base.files;
+        int err2 = cabd_read_files(sys, fh, cab, num_folders, num_files, 
salvage);
+        struct mscabd_file *f2 = cab->base.files;
+        /* combine both lists of files */
+        if (f1 && f1 != f2) {
+           struct mscabd_file *f1end = f1;
+           while (f1end->next) f1end = f1end->next;
+           f1end->next = f2;
+           cab->base.files = f1;
+        }
+        /* combine both cabd_read_files() errors */
+        err = err ? err : err2;
+      }
+    }
+  }
+
+  /* ignore errors if salvage mode finds files */
+  if (err) {
+    if (salvage && cab->base.files) {
+      if (!quiet) sys->message(fh, "WARNING; ignoring error %d while 
salvaging", err);
+    }
+    else {
+      return err;
+    }
+  }
+
+  if (cab->base.files == NULL) {
+    /* We never actually added any files to the file list.  Something went 
wrong.
+     * The file header may have been invalid */
+    D(("No files found, even though header claimed to have %d files", 
num_files))
+    return MSPACK_ERR_DATAFORMAT;
+  }
+
+  return MSPACK_ERR_OK;
+}
+
+static char *cabd_read_string(struct mspack_system *sys,
+                              struct mspack_file *fh, int permit_empty,
+                              int *error)
+{
+  off_t base = sys->tell(fh);
+  char buf[256], *str;
+  int len, i, ok;
+
+  /* read up to 256 bytes */
+  if ((len = sys->read(fh, &buf[0], 256)) <= 0) {
+    *error = MSPACK_ERR_READ;
+    return NULL;
+  }
+
+  /* search for a null terminator in the buffer */
+  for (i = 0, ok = 0; i < len; i++) if (!buf[i]) { ok = 1; break; }
+
+  if (!ok) {
+    *error = MSPACK_ERR_DATAFORMAT;
+    return NULL;
+  }
+
+  len = i + 1;
+
+  /* set the data stream to just after the string and return */
+  if (sys->seek(fh, base + (off_t)len, MSPACK_SYS_SEEK_START)) {
+    *error = MSPACK_ERR_SEEK;
+    return NULL;
+  }
+
+  /* optionally reject empty strings */
+  if (len == 1 && !permit_empty) {
+    *error = MSPACK_ERR_DATAFORMAT;
+    return NULL;
+  }
+
+  if (!(str = (char *) sys->alloc(sys, len))) {
+    *error = MSPACK_ERR_NOMEMORY;
+    return NULL;
+  }
+
+  sys->copy(&buf[0], str, len);
+  *error = MSPACK_ERR_OK;
+  return str;
+}
+
+static int cabd_read_files(struct mspack_system *sys,
+                           struct mspack_file *fh,
+                           struct mscabd_cabinet_p *cab,
+                           int num_folders, int num_files, int salvage)
+{
+  int i, x, err, fidx;
+  struct mscabd_file *file, *linkfile = NULL;
+  unsigned char buf[64];
+
   for (i = 0; i < num_files; i++) {
     if (sys->read(fh, &buf[0], cffile_SIZEOF) != cffile_SIZEOF) {
       return MSPACK_ERR_READ;
@@ -468,31 +585,19 @@
         file->folder = NULL;
       }
     }
-    else {
-      /* either CONTINUED_TO_NEXT, CONTINUED_FROM_PREV or
-       * CONTINUED_PREV_AND_NEXT */
-      if ((fidx == cffileCONTINUED_TO_NEXT) ||
-          (fidx == cffileCONTINUED_PREV_AND_NEXT))
-      {
-        /* get last folder */
-        struct mscabd_folder *ifol = cab->base.folders;
-        while (ifol->next) ifol = ifol->next;
-        file->folder = ifol;
-
-        /* set "merge next" pointer */
-        fol = (struct mscabd_folder_p *) ifol;
-        if (!fol->merge_next) fol->merge_next = file;
-      }
-
-      if ((fidx == cffileCONTINUED_FROM_PREV) ||
-          (fidx == cffileCONTINUED_PREV_AND_NEXT))
-      {
-        /* get first folder */
-        file->folder = cab->base.folders;
-
-        /* set "merge prev" pointer */
-        fol = (struct mscabd_folder_p *) file->folder;
-        if (!fol->merge_prev) fol->merge_prev = file;
+    else if (fidx == cffileCONTINUED_FROM_PREV) {
+      file->folder = cab->base.folders; /* in the first folder */
+    }
+    else if (fidx == cffileCONTINUED_TO_NEXT) {
+      struct mscabd_folder *lastfol = cab->base.folders;
+      while (lastfol->next) lastfol = lastfol->next;
+      file->folder = lastfol; /* in the last folder */
+    }
+    else if (fidx == cffileCONTINUED_PREV_AND_NEXT) {
+      file->folder = cab->base.folders; /* in the first and ONLY folder */
+      if (cab->base.folders->next) {
+        D(("file continued prev and next but more than one folder in cab"))
+        file->folder = NULL; /* error if cab has more than one folder */
       }
     }
 
@@ -519,64 +624,24 @@
       return err ? err : MSPACK_ERR_DATAFORMAT;
     }
 
+    /* if this is the first split file, set folder merge pointers */
+    if (fidx == cffileCONTINUED_TO_NEXT || fidx == 
cffileCONTINUED_PREV_AND_NEXT) {
+      struct mscabd_folder_p *fol = (struct mscabd_folder_p *) file->folder;
+      if (!fol->merge_next) fol->merge_next = file;
+    }
+    if (fidx == cffileCONTINUED_FROM_PREV || fidx == 
cffileCONTINUED_PREV_AND_NEXT) {
+      struct mscabd_folder_p *fol = (struct mscabd_folder_p *) file->folder;
+      if (!fol->merge_prev) fol->merge_prev = file;
+    }
+
     /* link file entry into file list */
     if (!linkfile) cab->base.files = file;
     else linkfile->next = file;
     linkfile = file;
   }
-
-  if (cab->base.files == NULL) {
-    /* We never actually added any files to the file list.  Something went 
wrong.
-     * The file header may have been invalid */
-    D(("No files found, even though header claimed to have %d files", 
num_files))
-    return MSPACK_ERR_DATAFORMAT;
-  }
-
   return MSPACK_ERR_OK;
 }
 
-static char *cabd_read_string(struct mspack_system *sys,
-                              struct mspack_file *fh, int permit_empty,
-                              int *error)
-{
-  off_t base = sys->tell(fh);
-  char buf[256], *str;
-  int len, i, ok;
-
-  /* read up to 256 bytes */
-  if ((len = sys->read(fh, &buf[0], 256)) <= 0) {
-    *error = MSPACK_ERR_READ;
-    return NULL;
-  }
-
-  /* search for a null terminator in the buffer */
-  for (i = 0, ok = 0; i < len; i++) if (!buf[i]) { ok = 1; break; }
-  /* optionally reject empty strings */
-  if (i == 0 && !permit_empty) ok = 0;
-
-  if (!ok) {
-    *error = MSPACK_ERR_DATAFORMAT;
-    return NULL;
-  }
-
-  len = i + 1;
-
-  /* set the data stream to just after the string and return */
-  if (sys->seek(fh, base + (off_t)len, MSPACK_SYS_SEEK_START)) {
-    *error = MSPACK_ERR_SEEK;
-    return NULL;
-  }
-
-  if (!(str = (char *) sys->alloc(sys, len))) {
-    *error = MSPACK_ERR_NOMEMORY;
-    return NULL;
-  }
-
-  sys->copy(&buf[0], str, len);
-  *error = MSPACK_ERR_OK;
-  return str;
-}
-    
 /***************************************
  * CABD_SEARCH, CABD_FIND
  ***************************************
@@ -738,7 +803,7 @@
             return MSPACK_ERR_NOMEMORY;
           }
           cab->base.filename = filename;
-          if (cabd_read_headers(sys, fh, cab, caboff, self->salvage, 1)) {
+          if (cabd_read_headers(sys, fh, cab, caboff, self->salvage, caboff > 
0)) {
             /* destroy the failed cabinet */
             cabd_close((struct mscab_decompressor *) self,
                        (struct mscabd_cabinet *) cab);
@@ -801,29 +866,43 @@
                         struct mscabd_cabinet *cab,
                         struct mscabd_cabinet *prevcab)
 {
-  return cabd_merge(base, prevcab, cab);
+  struct mscab_decompressor_p *self = (struct mscab_decompressor_p *) base;
+
+  if (!self) return MSPACK_ERR_ARGS;
+
+  if (prevcab && (prevcab->next || prevcab->base_offset)) {
+    D(("prevcab is from search() not open()"))
+    return self->error = MSPACK_ERR_ARGS;
+  }
+
+  return cabd_merge(self, prevcab, cab);
 }
 
 static int cabd_append(struct mscab_decompressor *base,
                         struct mscabd_cabinet *cab,
                         struct mscabd_cabinet *nextcab)
 {
-  return cabd_merge(base, cab, nextcab);
+  struct mscab_decompressor_p *self = (struct mscab_decompressor_p *) base;
+
+  if (!self) return MSPACK_ERR_ARGS;
+
+  if (nextcab && (nextcab->next || nextcab->base_offset)) {
+    D(("nextcab is from search() not open()"))
+    return self->error = MSPACK_ERR_ARGS;
+  }
+
+  return cabd_merge(self, cab, nextcab);
 }
 
-static int cabd_merge(struct mscab_decompressor *base,
+static int cabd_merge(struct mscab_decompressor_p *self,
                       struct mscabd_cabinet *lcab,
                       struct mscabd_cabinet *rcab)
 {
-  struct mscab_decompressor_p *self = (struct mscab_decompressor_p *) base;
   struct mscabd_folder_data *data, *ndata;
   struct mscabd_folder_p *lfol, *rfol;
   struct mscabd_file *fi, *rfi, *lfi;
   struct mscabd_cabinet *cab;
-  struct mspack_system *sys;
-
-  if (!self) return MSPACK_ERR_ARGS;
-  sys = self->system;
+  struct mspack_system *sys = self->system;
 
   /* basic args check */
   if (!lcab || !rcab || (lcab == rcab)) {
@@ -1166,21 +1245,21 @@
 
   switch (ct & cffoldCOMPTYPE_MASK) {
   case cffoldCOMPTYPE_NONE:
-    self->d->decompress = (int (*)(void *, off_t)) &noned_decompress;
+    self->d->decompress = &noned_decompress;
     self->d->state = noned_init(&self->d->sys, fh, fh, self->buf_size);
     break;
   case cffoldCOMPTYPE_MSZIP:
-    self->d->decompress = (int (*)(void *, off_t)) &mszipd_decompress;
+    self->d->decompress = &mszipd_decompress_wrapper;
     self->d->state = mszipd_init(&self->d->sys, fh, fh, self->buf_size,
                                  self->fix_mszip);
     break;
   case cffoldCOMPTYPE_QUANTUM:
-    self->d->decompress = (int (*)(void *, off_t)) &qtmd_decompress;
+    self->d->decompress = &qtmd_decompress_wrapper;
     self->d->state = qtmd_init(&self->d->sys, fh, fh, (int) (ct >> 8) & 0x1f,
                                self->buf_size);
     break;
   case cffoldCOMPTYPE_LZX:
-    self->d->decompress = (int (*)(void *, off_t)) &lzxd_decompress;
+    self->d->decompress = &lzxd_decompress_wrapper;
     self->d->state = lzxd_init(&self->d->sys, fh, fh, (int) (ct >> 8) & 0x1f, 
0,
                                self->buf_size, (off_t)0,0);
     break;
@@ -1414,6 +1493,22 @@
 }
 
 /***************************************
+ * {MSZIP,LZX,QTM}D_DECOMPRESS_WRAPPER
+ ***************************************
+ * UBSan complains about calling a function like int foo(struct foo*, off_t)
+ * through a pointer like (int (*)(void *, off_t)) so do it indirectly
+ */
+static int mszipd_decompress_wrapper(void *state, off_t bytes) {
+  return mszipd_decompress((struct mszipd_stream *)state, bytes);
+}
+static int lzxd_decompress_wrapper(void *state, off_t bytes) {
+  return lzxd_decompress((struct lzxd_stream *)state, bytes);
+}
+static int qtmd_decompress_wrapper(void *state, off_t bytes) {
+  return qtmd_decompress((struct qtmd_stream *)state, bytes);
+}
+
+/***************************************
  * NONED_INIT, NONED_DECOMPRESS, NONED_FREE
  ***************************************
  * the "not compressed" method decompressor
@@ -1448,7 +1543,8 @@
   return state;
 }
 
-static int noned_decompress(struct noned_state *s, off_t bytes) {
+static int noned_decompress(void *state, off_t bytes) {
+  struct noned_state *s = (struct noned_state *) state;
   int run;
   while (bytes > 0) {
     run = (bytes > s->bufsize) ? s->bufsize : (int) bytes;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabextract-1.11/mspack/lzx.h 
new/cabextract-1.12/mspack/lzx.h
--- old/cabextract-1.11/mspack/lzx.h    2023-02-07 11:53:01.000000000 +0100
+++ new/cabextract-1.12/mspack/lzx.h    2026-08-30 04:59:41.000000000 +0200
@@ -45,6 +45,31 @@
 
 #define LZX_FRAME_SIZE (32768) /* the size of a frame in LZX */
 
+#if (1 << LZX_PRETREE_TABLEBITS) < (LZX_PRETREE_MAXSYMBOLS * 2)
+# define LZX_PRETREE_TABLESIZE (LZX_PRETREE_MAXSYMBOLS * 4)
+#else
+# define LZX_PRETREE_TABLESIZE ((1 << LZX_PRETREE_TABLEBITS) + \
+                                (LZX_PRETREE_MAXSYMBOLS * 2))
+#endif
+#if (1 << LZX_MAINTREE_TABLEBITS) < (LZX_MAINTREE_MAXSYMBOLS * 2)
+# define LZX_MAINTREE_TABLESIZE (LZX_MAINTREE_MAXSYMBOLS * 4)
+#else
+# define LZX_MAINTREE_TABLESIZE ((1 << LZX_MAINTREE_TABLEBITS) + \
+                                 (LZX_MAINTREE_MAXSYMBOLS * 2))
+#endif
+#if (1 << LZX_LENGTH_TABLEBITS) < (LZX_LENGTH_MAXSYMBOLS * 2)
+# define LZX_LENGTH_TABLESIZE (LZX_LENGTH_MAXSYMBOLS * 4)
+#else
+# define LZX_LENGTH_TABLESIZE ((1 << LZX_LENGTH_TABLEBITS) + \
+                               (LZX_LENGTH_MAXSYMBOLS * 2))
+#endif
+#if (1 << LZX_ALIGNED_TABLEBITS) < (LZX_ALIGNED_MAXSYMBOLS * 2)
+# define LZX_ALIGNED_TABLESIZE (LZX_ALIGNED_MAXSYMBOLS * 4)
+#else
+# define LZX_ALIGNED_TABLESIZE ((1 << LZX_ALIGNED_TABLEBITS) + \
+                                (LZX_ALIGNED_MAXSYMBOLS * 2))
+#endif
+
 struct lzxd_stream {
   struct mspack_system *sys;      /* I/O routines                            */
   struct mspack_file   *input;    /* input file handle                       */
@@ -87,14 +112,10 @@
   unsigned char ALIGNED_len  [LZX_ALIGNED_MAXSYMBOLS  + LZX_LENTABLE_SAFETY];
 
   /* huffman decoding tables */
-  unsigned short PRETREE_table [(1 << LZX_PRETREE_TABLEBITS) +
-                                (LZX_PRETREE_MAXSYMBOLS * 2)];
-  unsigned short MAINTREE_table[(1 << LZX_MAINTREE_TABLEBITS) +
-                                (LZX_MAINTREE_MAXSYMBOLS * 2)];
-  unsigned short LENGTH_table  [(1 << LZX_LENGTH_TABLEBITS) +
-                                (LZX_LENGTH_MAXSYMBOLS * 2)];
-  unsigned short ALIGNED_table [(1 << LZX_ALIGNED_TABLEBITS) +
-                                (LZX_ALIGNED_MAXSYMBOLS * 2)];
+  unsigned short PRETREE_table [LZX_PRETREE_TABLESIZE];
+  unsigned short MAINTREE_table[LZX_MAINTREE_TABLESIZE];
+  unsigned short LENGTH_table  [LZX_LENGTH_TABLESIZE];
+  unsigned short ALIGNED_table [LZX_ALIGNED_TABLESIZE];
   unsigned char LENGTH_empty;
 
   /* this is used purely for doing the intel E8 transform */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabextract-1.11/mspack/lzxd.c 
new/cabextract-1.12/mspack/lzxd.c
--- old/cabextract-1.11/mspack/lzxd.c   2023-02-13 01:05:13.000000000 +0100
+++ new/cabextract-1.12/mspack/lzxd.c   2026-09-24 20:53:28.000000000 +0200
@@ -280,7 +280,7 @@
                               off_t output_length,
                               char is_delta)
 {
-  unsigned int window_size = 1 << window_bits;
+  unsigned int window_size = 1U << window_bits;
   struct lzxd_stream *lzx;
 
   if (!system) return NULL;
@@ -448,7 +448,7 @@
       /* read 1 bit. if bit=0, intel filesize = 0.
        * if bit=1, read intel filesize (32 bits) */
       j = 0; READ_BITS(i, 1); if (i) { READ_BITS(i, 16); READ_BITS(j, 16); }
-      lzx->intel_filesize = (i << 16) | j;
+      lzx->intel_filesize = (int) (((unsigned int) i << 16) | (unsigned int) 
j);
       lzx->header_read = 1;
     } 
 
@@ -514,6 +514,12 @@
           R0 = EndGetI32(&buf[0]);
           R1 = EndGetI32(&buf[4]);
           R2 = EndGetI32(&buf[8]);
+          if (R0 >= lzx->window_size || R1 >= lzx->window_size ||
+              R2 >= lzx->window_size)
+          {
+            D(("overlong R0/R1/R2 offset in uncompressed block header"))
+            return lzx->error = MSPACK_ERR_DECRUNCH;
+          }
           break;
 
         default:
@@ -628,7 +634,7 @@
               }
               /* j = length from match offset to end of window */
               j = match_offset - window_posn;
-              if (j > (int) lzx->window_size) {
+              if (j < 0 || j > (int) lzx->window_size) {
                 D(("match offset beyond window boundaries"))
                 return lzx->error = MSPACK_ERR_DECRUNCH;
               }
@@ -719,7 +725,7 @@
 
       while (data < dataend) {
         if (*data++ != 0xE8) { curpos++; continue; }
-        abs_off = EndGetI32(data);
+        abs_off = (int) EndGetI32(data);
         if ((abs_off >= -curpos) && (abs_off < filesize)) {
           rel_off = (abs_off >= 0) ? abs_off - curpos : abs_off + filesize;
           data[0] = (unsigned char) rel_off;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabextract-1.11/mspack/mspack.h 
new/cabextract-1.12/mspack/mspack.h
--- old/cabextract-1.11/mspack/mspack.h 2020-04-10 13:48:14.000000000 +0200
+++ new/cabextract-1.12/mspack/mspack.h 2026-10-25 14:33:23.000000000 +0100
@@ -1080,10 +1080,10 @@
    *
    * @param  self     a self-referential pointer to the mscab_decompressor
    *                  instance being called
-   * @param  cab      the cabinet which will be appended to,
-   *                  predecessor of nextcab
-   * @param  nextcab  the cabinet which will be appended,
-   *                  successor of cab
+   * @param  cab      the cabinet which will be appended to, predecessor
+   *                  of nextcab. Can come from open() or search()
+   * @param  nextcab  the cabinet which will be appended, successor
+   *                  of cab. Must come from open(), not search()
    * @return an error code, or MSPACK_ERR_OK if successful
    * @see prepend(), open(), close()
    */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabextract-1.11/mspack/mszipd.c 
new/cabextract-1.12/mspack/mszipd.c
--- old/cabextract-1.11/mspack/mszipd.c 2023-02-07 11:53:01.000000000 +0100
+++ new/cabextract-1.12/mspack/mszipd.c 2026-09-23 12:54:46.000000000 +0200
@@ -368,6 +368,9 @@
   zip->repair_mode     = repair_mode;
   zip->flush_window    = &mszipd_flush_window;
 
+  /* prevent overlong match offset reading uninitialised memory */
+  memset(&zip->window[0], 0, MSZIP_FRAME_SIZE);
+
   zip->i_ptr = zip->i_end = &zip->inbuf[0];
   zip->o_ptr = zip->o_end = NULL;
   zip->bit_buffer = 0; zip->bits_left = 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabextract-1.11/mspack/qtm.h 
new/cabextract-1.12/mspack/qtm.h
--- old/cabextract-1.11/mspack/qtm.h    2023-02-07 11:53:01.000000000 +0100
+++ new/cabextract-1.12/mspack/qtm.h    2026-09-22 14:33:28.000000000 +0200
@@ -42,6 +42,7 @@
 
   unsigned short H, L, C;         /* high/low/current: arith coding state    */
   unsigned char header_read;      /* have we started decoding a new frame?   */
+  unsigned char window_wrap;      /* have we decoded >=1 window of data?     */
 
   int error;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabextract-1.11/mspack/qtmd.c 
new/cabextract-1.12/mspack/qtmd.c
--- old/cabextract-1.11/mspack/qtmd.c   2023-02-07 11:53:01.000000000 +0100
+++ new/cabextract-1.12/mspack/qtmd.c   2026-09-23 13:44:28.000000000 +0200
@@ -114,9 +114,10 @@
       }                                                                 \
       else break;                                                       \
     }                                                                   \
-    L <<= 1; H = (H << 1) | 1;                                          \
+    L = (unsigned short) (L << 1);                                      \
+    H = (unsigned short) ((H << 1) | 1);                                \
     ENSURE_BITS(1);                                                     \
-    C  = (C << 1) | PEEK_BITS(1);                                       \
+    C  = (unsigned short) ((C << 1) | PEEK_BITS(1));                    \
     REMOVE_BITS(1);                                                     \
   }                                                                     \
 } while (0)
@@ -188,7 +189,7 @@
                               struct mspack_file *output,
                               int window_bits, int input_buffer_size)
 {
-  unsigned int window_size = 1 << window_bits;
+  unsigned int window_size = 1U << window_bits;
   struct qtmd_stream *qtm;
   int i;
 
@@ -225,6 +226,7 @@
   qtm->window_posn = 0;
   qtm->frame_todo  = QTM_FRAME_SIZE;
   qtm->header_read = 0;
+  qtm->window_wrap = 0;
   qtm->error       = MSPACK_ERR_OK;
 
   qtm->i_ptr = qtm->i_end = &qtm->inbuf[0];
@@ -348,6 +350,12 @@
           return qtm->error = MSPACK_ERR_DECRUNCH;
         }
 
+        /* does match offset go beyond what we've decoded so far? */
+        if (match_offset > window_posn && !qtm->window_wrap) {
+            D(("match offset beyond decoded stream"))
+            return qtm->error = MSPACK_ERR_DECRUNCH;
+        }
+
         rundest = &window[window_posn];
         frame_todo -= match_length;
 
@@ -442,6 +450,7 @@
 
     /* window wrap? */
     if (window_posn == qtm->window_size) {
+      qtm->window_wrap = 1;
       /* flush all currently stored data */
       i = (qtm->o_end - qtm->o_ptr);
       /* break out if we have more than enough to finish this request */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabextract-1.11/mspack/readhuff.h 
new/cabextract-1.12/mspack/readhuff.h
--- old/cabextract-1.11/mspack/readhuff.h       2023-02-07 11:53:01.000000000 
+0100
+++ new/cabextract-1.12/mspack/readhuff.h       2026-08-30 05:47:14.000000000 
+0200
@@ -76,14 +76,15 @@
  *          in one lookup of the table.
  * length = A table to get code lengths from [0 to nsyms-1]
  * table  = The table to fill up with decoded symbols and pointers.
- *          Should be ((1<<nbits) + (nsyms*2)) in length.
+ *          Should be ((1<<nbits) + (nsyms*2)) in length,
+ *          or (nsyms*4) in length if (1<<nbits) < (nsyms*2)
  *
  * Returns 0 for OK or 1 for error
  */
 static int make_decode_table(unsigned int nsyms, unsigned int nbits,
                              unsigned char *length, unsigned short *table)
 {
-    register unsigned short sym, next_symbol;
+    register unsigned short sym, next_symbol, end;
     register unsigned int leaf, fill;
 #ifdef BITS_ORDER_LSB
     register unsigned int reverse;
@@ -134,6 +135,7 @@
 
     /* next_symbol = base of allocation for long codes */
     next_symbol = ((table_mask >> 1) < nsyms) ? nsyms : (table_mask >> 1);
+    end = next_symbol + nsyms;
 
     /* give ourselves room for codes to grow by up to 16 more bits.
      * codes now start at bit nbits+16 and end at (nbits+16-codelength) */
@@ -156,6 +158,7 @@
             for (fill = 0; fill < (bit_num - nbits); fill++) {
                 /* if this path hasn't been taken yet, 'allocate' two entries 
*/
                 if (table[leaf] == 0xFFFF) {
+                    if (next_symbol >= end) return 1; /* table overflow */
                     table[(next_symbol << 1)     ] = 0xFFFF;
                     table[(next_symbol << 1) + 1 ] = 0xFFFF;
                     table[leaf] = next_symbol++;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabextract-1.11/src/cabextract.c 
new/cabextract-1.12/src/cabextract.c
--- old/cabextract-1.11/src/cabextract.c        2023-02-24 12:57:14.000000000 
+0100
+++ new/cabextract-1.12/src/cabextract.c        2026-07-20 17:10:51.000000000 
+0200
@@ -479,7 +479,7 @@
      * include that. So, we work out where the filename part of the
      * output name begins. This is the same for every extracted file.
      */
-    fname_offset = args.dir ? (strlen(args.dir) + 1) : 0;
+    fname_offset = args.dir ? ((int) strlen(args.dir) + 1) : 0;
 
     /* process all files */
     for (file = cab->files; file; file = file->next) {
@@ -526,7 +526,7 @@
 
           /* "  filename  OK  " is 8 chars + the length of filename,
            * the MD5 checksum itself is 32 chars. */
-          int spaces = 79 - (strlen(name) + 8 + 32);
+          int spaces = 79 - ((int) strlen(name) + 8 + 32);
           printf("  %s  OK  ", name);
           while (spaces-- > 0) putchar(' ');
           printf("%02x%02x%02x%02x%02x%02x%02x%02x"
Binary files old/cabextract-1.11/test/cabs/hidden-files.cab and 
new/cabextract-1.12/test/cabs/hidden-files.cab differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cabextract-1.11/test/hidden-files.test 
new/cabextract-1.12/test/hidden-files.test
--- old/cabextract-1.11/test/hidden-files.test  1970-01-01 01:00:00.000000000 
+0100
+++ new/cabextract-1.12/test/hidden-files.test  2026-09-23 14:20:19.000000000 
+0200
@@ -0,0 +1,31 @@
+#!/bin/sh
+# test cabextract sees hidden files at cfhead_FileOffset with -f option
+. test/testcase
+
+"$cabextract" -l cabs/hidden-files.cab >$actual 2>&1
+compare_with <<'EOF'
+cabs/hidden-files.cab: WARNING; atypical files offset in header
+Viewing cabinet: cabs/hidden-files.cab
+ File size | Date       Time     | Name
+-----------+---------------------+-------------
+         0 | 12.03.1997 11:13:52 | normal1.txt
+         0 | 12.03.1997 11:13:52 | normal2.txt
+
+All done, no errors.
+EOF
+
+"$cabextract" -fl cabs/hidden-files.cab >$actual 2>&1
+compare_with <<'EOF'
+cabs/hidden-files.cab: WARNING; atypical files offset in header
+Viewing cabinet: cabs/hidden-files.cab
+ File size | Date       Time     | Name
+-----------+---------------------+-------------
+         0 | 12.03.1997 11:13:52 | normal1.txt
+         0 | 12.03.1997 11:13:52 | normal2.txt
+         0 | 12.03.1997 11:13:52 | hidden1.txt
+         0 | 12.03.1997 11:13:52 | hidden2.txt
+
+All done, no errors.
+EOF
+
+read status < $status && test "x$status" = xsuccess

Reply via email to