[Scummvm-git-logs] scummvm branch-2-7 -> a434986c728e0af857936e12474b113b1fc28fc6

sev- noreply at scummvm.org
Fri Mar 3 22:24:37 UTC 2023


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:
0d7b12306a COMMON: Split assert() for more finetuned crash reporting
a434986c72 COMMON: Do not crash on attempt to punyencode empty strings


Commit: 0d7b12306a5786faa9db1e3605ead5fd301d85d9
    https://github.com/scummvm/scummvm/commit/0d7b12306a5786faa9db1e3605ead5fd301d85d9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-03-03T23:24:23+01:00

Commit Message:
COMMON: Split assert() for more finetuned crash reporting

Changed paths:
    common/str-base.h


diff --git a/common/str-base.h b/common/str-base.h
index 3c36abeb4b6..9fb35571a33 100644
--- a/common/str-base.h
+++ b/common/str-base.h
@@ -175,7 +175,9 @@ public:
 	value_type lastChar() const     { return (_size > 0) ? _str[_size - 1] : 0; }
 
 	value_type operator[](int idx) const {
-		assert(_str && idx >= 0 && idx < (int)_size);
+		assert(_str);
+		assert(idx >= 0);
+		assert(idx < (int)_size);
 		return _str[idx];
 	}
 


Commit: a434986c728e0af857936e12474b113b1fc28fc6
    https://github.com/scummvm/scummvm/commit/a434986c728e0af857936e12474b113b1fc28fc6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-03-03T23:24:31+01:00

Commit Message:
COMMON: Do not crash on attempt to punyencode empty strings

Changed paths:
    common/punycode.cpp


diff --git a/common/punycode.cpp b/common/punycode.cpp
index c894db4c002..60f8caab326 100644
--- a/common/punycode.cpp
+++ b/common/punycode.cpp
@@ -132,6 +132,9 @@ String punycode_encode(const U32String &src) {
 	size_t h = 0, si;
 	String dst = "xn--";
 
+	if (!srclen)
+		return src;
+
 	for (si = 0; si < srclen; si++) {
 		if (src[si] < 128) {
 			dst += src[si];
@@ -204,6 +207,9 @@ bool punycode_hasprefix(const String &src) {
 }
 
 bool punycode_needEncode(const String &src) {
+	if (!src.size())
+		return false;
+
 	for (uint si = 0; si < src.size(); si++) {
 		if (src[si] & 0x80 || src[si] < 0x20 || strchr(SPECIAL_SYMBOLS, src[si])) {
 			return true;




More information about the Scummvm-git-logs mailing list