commit 6f5881e: [Minor] Escape \uFFFD in the sources

Vsevolod Stakhov vsevolod at highsecure.ru
Fri Sep 17 11:49:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-09-17 12:46:41 +0100
URL: https://github.com/rspamd/rspamd/commit/6f5881e0bb7468a4ff1a52bdbd40cc36102639fd (HEAD -> master)

[Minor] Escape \uFFFD in the sources

---
 src/libserver/html/html_entities.cxx | 6 +++---
 src/libutil/cxx/utf8_util.cxx        | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/libserver/html/html_entities.cxx b/src/libserver/html/html_entities.cxx
index 912da6e58..8a3ff61da 100644
--- a/src/libserver/html/html_entities.cxx
+++ b/src/libserver/html/html_entities.cxx
@@ -2605,10 +2605,10 @@ TEST_SUITE("html entities") {
 				{"FOO&#ZOO", "FOO&#ZOO"},
 				{"FOO&#xBAR", "FOOºR"},
 				{"FOO&#x41BAR", "FOO䆺R"},
-				{"FOO�ZOO", "FOO�ZOO"},
+				{"FOO�ZOO", "FOO\uFFFDZOO"},
 				{"FOOZOO", "FOO\u0081ZOO"},
-				{"FOO�ZOO", "FOO�ZOO"},
-				{"FOO�ZOO", "FOO�ZOO"},
+				{"FOO�ZOO", "FOO\uFFFDZOO"},
+				{"FOO�ZOO", "FOO\uFFFDZOO"},
 				{"ZZ&pound_id=23", "ZZ£_id=23"},
 				{"ZZ&prod_id=23", "ZZ&prod_id=23"},
 				{"ZZ&gt", "ZZ>"},
diff --git a/src/libutil/cxx/utf8_util.cxx b/src/libutil/cxx/utf8_util.cxx
index cf6e70fe6..da68c990c 100644
--- a/src/libutil/cxx/utf8_util.cxx
+++ b/src/libutil/cxx/utf8_util.cxx
@@ -225,7 +225,7 @@ TEST_CASE("utf8 normalise") {
 			{"13\u200C_\u0020\u0308\u0301\u038e\u03ab\u200D", "13_ ̈́ΎΫ",
 					RSPAMD_UNICODE_NORM_UNNORMAL|RSPAMD_UNICODE_NORM_ZERO_SPACES},
 			/* Buffer overflow case */
-			{"u\xC2\xC2\xC2\xC2\xC2\xC2""abcdef""abcdef", "u������",
+			{"u\xC2\xC2\xC2\xC2\xC2\xC2""abcdef""abcdef", "u\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD",
 					RSPAMD_UNICODE_NORM_UNNORMAL|RSPAMD_UNICODE_NORM_ERROR},
 	};
 


More information about the Commits mailing list