]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Escape \uFFFD in the sources
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 17 Sep 2021 11:46:41 +0000 (12:46 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 17 Sep 2021 11:47:08 +0000 (12:47 +0100)
src/libserver/html/html_entities.cxx
src/libutil/cxx/utf8_util.cxx

index 912da6e58d28d34f8f203c49b90a3b86b63c0c73..8a3ff61daaf4f0ae14020fe4a6a4f3e973701f05 100644 (file)
@@ -2605,10 +2605,10 @@ TEST_SUITE("html entities") {
                                {"FOO&#ZOO", "FOO&#ZOO"},
                                {"FOO&#xBAR", "FOOºR"},
                                {"FOO&#x41BAR", "FOO䆺R"},
-                               {"FOO&#x0000;ZOO", "FOOZOO"},
+                               {"FOO&#x0000;ZOO", "FOO\uFFFDZOO"},
                                {"FOO&#x0081;ZOO", "FOO\u0081ZOO"},
-                               {"FOO&#xD800;ZOO", "FOOZOO"},
-                               {"FOO&#xFFFFFF;ZOO", "FOOZOO"},
+                               {"FOO&#xD800;ZOO", "FOO\uFFFDZOO"},
+                               {"FOO&#xFFFFFF;ZOO", "FOO\uFFFDZOO"},
                                {"ZZ&pound_id=23", "ZZ£_id=23"},
                                {"ZZ&prod_id=23", "ZZ&prod_id=23"},
                                {"ZZ&gt", "ZZ>"},
index cf6e70fe6413bc72dbbd9302c1835d8dfc948124..da68c990cf906efe54c2ff7190555072a51d7a56 100644 (file)
@@ -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},
        };