]> wimlib.net Git - wimlib/commitdiff
Fix xml_legal_value() with signed char
authorEric Biggers <ebiggers3@gmail.com>
Tue, 29 Aug 2023 04:00:04 +0000 (21:00 -0700)
committerEric Biggers <ebiggers3@gmail.com>
Tue, 29 Aug 2023 04:33:13 +0000 (21:33 -0700)
Fixes: cd9959b4f62a ("Eliminate the dependency on libxml2")
Resolves https://wimlib.net/forums/viewtopic.php?p=1608

NEWS.md
src/xmlproc.c
tests/test-imagex

diff --git a/NEWS.md b/NEWS.md
index d3637c024fbd5b0729306aa6e65004fe5956dc05..8287edb1aa6073b6e194979bbfcdeb5e60dcc10c 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,5 +1,11 @@
 # wimlib release notes
 
+## Version 1.14.3-BETA1
+
+- Fixed a bug introduced in v1.14.0 where non-ASCII characters stopped being
+  accepted in image names and descriptions.  This bug only affected UNIX-like
+  systems that use `signed char`, e.g. x86 Linux systems.
+
 ## Version 1.14.2
 
 - Fixed a bug introduced in v1.14.0 where a crash would sometimes occur if a
index d5de89453e4b7fb9c424f97ed83fd1b355ebf46c..6e1d2c168f4f7bd968a0c3ffaa434fb6161265f4 100644 (file)
@@ -341,7 +341,8 @@ bool
 xml_legal_value(const tchar *p)
 {
        for (; *p; p++) {
-               if (*p < 0x20 && !is_whitespace(*p))
+               /* Careful: tchar can be signed. */
+               if (*p > 0 && *p < 0x20 && !is_whitespace(*p))
                        return false;
        }
        return true;
index 1d9fe820833c69e58b5209526af85a5a87f7fb26..c5e273f2de9296706ffc19afbdaaff56fcc3fd44 100755 (executable)
@@ -131,16 +131,26 @@ if ! test "`wiminfo dir.wim | grep '^Boot Index' | awk '{print $3}'`" = "0"; the
 fi
 rm -rf dir.wim tmp
 
+name_desc_test() {
+       local name=$1
+       local desc=$2
+       if ! wimcapture dir dir.wim "$name" "$desc"; then
+               error "Failed to capture WIM with specified name and description"
+       fi
+       if ! test "`wiminfo dir.wim | grep Name | awk '{print $2}'`" = "$name"; then
+               error "WIM name not set correctly"
+       fi
+       if ! test "`wiminfo dir.wim | grep Description | awk '{print $2}'`" = "$desc"; then
+               error "WIM description not set correctly"
+       fi
+}
+
 echo "Testing capture of WIM with name and description"
-if ! wimcapture dir dir.wim "myname" "mydesc"; then
-       error "Failed to capture WIM with specified name and description"
-fi
-if ! test "`wiminfo dir.wim | grep Name | awk '{print $2}'`" = "myname"; then
-       error "WIM name not set correctly"
-fi
-if ! test "`wiminfo dir.wim | grep Description | awk '{print $2}'`" = "mydesc"; then
-       error "WIM name not set correctly"
-fi
+name_desc_test "myname" "mydesc"
+
+echo "Testing capture of WIM with non-ASCII name and description"
+name_desc_test "áéíóú" "¿?"
+
 echo "Testing printing WIM lookup table"
 if ! wiminfo --lookup-table dir.wim > /dev/null; then
        error "Failed to print WIM lookup table"