From fc03b00ddf68ef2075aa56dbaa0d1bbb19c5f7e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Fri, 24 May 2019 13:03:11 +0200 Subject: Fix build failure in csharp/ --- csharp/Makefile.am | 6 +++--- lib/punycode.c | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/csharp/Makefile.am b/csharp/Makefile.am index 7afdea9..4625738 100644 --- a/csharp/Makefile.am +++ b/csharp/Makefile.am @@ -59,15 +59,15 @@ GenerateTables.exe: $(SOURCES_GENERATE) `for src in $(SOURCES_GENERATE); do echo $(srcdir)/$$src; done` if ! test -f rfc3454.txt; then \ ln -s $(SPEC)/rfc3454.txt . \ - || cp $(SPEC)/rfc3454.txt .; \ + || cp $(SPEC)/rfc3454.txt . || true; \ fi if ! test -f UnicodeData.txt; then \ ln -s $(SPEC)/UnicodeData-3.2.0.txt UnicodeData.txt \ - || cp $(SPEC)/UnicodeData-3.2.0.txt UnicodeData.txt; \ + || cp $(SPEC)/UnicodeData-3.2.0.txt UnicodeData.txt || true; \ fi if ! test -f CompositionExclusions.txt; then \ ln -s $(SPEC)/CompositionExclusions-3.2.0.txt CompositionExclusions.txt \ - || cp $(SPEC)/CompositionExclusions-3.2.0.txt CompositionExclusions.txt; \ + || cp $(SPEC)/CompositionExclusions-3.2.0.txt CompositionExclusions.txt || true; \ fi RFC3454.cs CombiningClass.cs DecompositionKeys.cs DecompositionMappings.cs Composition.cs: $(GEN_SOURCES) diff --git a/lib/punycode.c b/lib/punycode.c index f7c63e6..bb5f34b 100644 --- a/lib/punycode.c +++ b/lib/punycode.c @@ -228,7 +228,7 @@ punycode_encode (size_t input_length, output[out++] = case_flags ? encode_basic (input[j], case_flags[j]) : (char) input[j]; } - else if (input[j] > 0x10FFFF) + else if (input[j] > 0x10FFFF || (input[j] >= 0xD800 && input[j] <= 0xDBFF)) return punycode_bad_input; /* else if (input[j] < n) return punycode_bad_input; */ /* (not needed for Punycode with unsigned code points) */ @@ -378,6 +378,9 @@ punycode_decode (size_t input_length, return punycode_bad_input; output[out++] = input[j]; } + for (j = b + (b > 0); j < input_length; ++j) + if (!basic (input[j])) + return punycode_bad_input; /* Main decoding loop: Start just after the last delimiter if any */ /* basic code points were copied; start at the beginning otherwise. */ @@ -420,7 +423,7 @@ punycode_decode (size_t input_length, if (i / (out + 1) > maxint - n) return punycode_overflow; n += i / (out + 1); - if (n > 0x10FFFF) + if (n > 0x10FFFF || (n >= 0xD800 && n <= 0xDBFF)) return punycode_bad_input; i %= (out + 1); -- cgit v1.0-41-gc330