[Scummvm-git-logs] scummvm master -> 1f40958a659fe76b89a2970e459d009b52aa3056

sev- sev at scummvm.org
Sun Aug 1 08:46:21 UTC 2021


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
5288422e26 DEVTOOLS: COMPANION: Escape more characters for shell commands
1f40958a65 COMMON: Punycode more invalid characters in filenames


Commit: 5288422e263648c20bbe4c3a60d4999209003d46
    https://github.com/scummvm/scummvm/commit/5288422e263648c20bbe4c3a60d4999209003d46
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-08-01T10:35:27+02:00

Commit Message:
DEVTOOLS: COMPANION: Escape more characters for shell commands

Changed paths:
    devtools/dumper-companion.pl


diff --git a/devtools/dumper-companion.pl b/devtools/dumper-companion.pl
index c1989dface..e34be9c605 100755
--- a/devtools/dumper-companion.pl
+++ b/devtools/dumper-companion.pl
@@ -193,7 +193,7 @@ sub processIso($) {
 				$prevlen = length "$dir$decfname";
 				flush STDOUT;
 
-				$fname =~ s/\*/\\\*/g; # Files cound have stars in them, escape, so shell is happy
+				$fname =~ s/([*+\[\]\|<>&])/\\$1/g; # Files cound have special symbols in them, escape, so shell is happy
 
 				if ($res != 0) {
 					system1("hcopy -m -- \"$mdir$fname\" \"$outPath$dir$decfname\"") == 0 or die "Can't execute hcopy";


Commit: 1f40958a659fe76b89a2970e459d009b52aa3056
    https://github.com/scummvm/scummvm/commit/1f40958a659fe76b89a2970e459d009b52aa3056
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-08-01T10:44:24+02:00

Commit Message:
COMMON: Punycode more invalid characters in filenames

Changed paths:
    common/punycode.cpp
    devtools/dumper-companion.pl


diff --git a/common/punycode.cpp b/common/punycode.cpp
index dc8e3c14a5..d382a834b1 100644
--- a/common/punycode.cpp
+++ b/common/punycode.cpp
@@ -303,9 +303,8 @@ String punycode_encodefilename(const String src) {
 		if ((byte)src[i] == 0x81) {	// In case we have our escape character present
 			dst += '\x81';
 			dst += '\x79';
-		// [\x00-\x1f\/":]
-		} else if (src[i] == '/' || src[i] == '"' || src[i] == ':' || src[i] == '*'
-				|| src[i] == '[' || src[i] == ']' || (byte)src[i] < 0x20) {
+		// Encode special symbols and non-printables
+		} else if (rindex("/\":*[]+|\\?%<>,;=", (byte)src[i]) || (byte)src[i] < 0x20) {
 			dst += '\x81';
 			dst += (byte)src[i] + '\x80';
 		} else {
diff --git a/devtools/dumper-companion.pl b/devtools/dumper-companion.pl
index e34be9c605..a3c7d08bbe 100755
--- a/devtools/dumper-companion.pl
+++ b/devtools/dumper-companion.pl
@@ -441,8 +441,8 @@ sub encode_punycodefilename {
 	my $decfname = shift;
 
 	$decfname =~ s/\x81/\x81\x79/g;
-	# escape non-printables, '/', '"', '*', '[', ']' and ':'
-	$decfname =~ s/([\x00-\x1f\/":\*\[\]])/\x81@{[chr(ord($1) + 0x80)]}/g;
+	# escape non-printables, "/"*[]:+|"
+	$decfname =~ s/([\x00-\x1f\/":\*\[\]\+\|\\?%<>,;=])/\x81@{[chr(ord($1) + 0x80)]}/g;
 
 	if ($decfname =~ /[\x80-\xff]/) {
 		$decfname = encode_punycode $decfname;




More information about the Scummvm-git-logs mailing list