New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] fix utf8.c overflowed VC6's preproc macro buffer and syntax errored #16499
Comments
From @bulk88Created by @bulk88See attached patch. This is intended for 5.28. Maybe backport too. VC6 details, console error cl -c -nologo -GF -W3 -I.\include -I. -I.. -DWIN32 -D_CONSOLE I've attached a code formatted preprocessed version of the C func that Perl Info
|
From @bulk880001-fix-utf8.c-overflowed-VC6-s-preproc-macro-buffer-and.patchFrom b94b17165dea31b2a11600bf3353f6c3ac38af6e Mon Sep 17 00:00:00 2001
From: Daniel Dragan <bulk88@hotmail.com>
Date: Sun, 8 Apr 2018 00:19:11 -0400
Subject: [PATCH] fix utf8.c overflowed VC6's preproc macro buffer and syntax
errored
Only happened with CFG=Debug/-DDEBUGGING. Non-debugging VC6 build not
affected.
cl -c -nologo -GF -W3 -I.\include -I. -I.. -DWIN32 -D_CONSOLE -DNO_STRICT
-DPERLDLL -DPERL_CORE -Od -MD -Zi -DDEBUGGING -DPERL_EXTERNAL_GLOB
-DPERL_IS_MINIPERL -Fomini\utf8.obj -Fdmini\utf8.pdb ..\utf8.c
utf8.c
..\utf8.c(4057) : error C2017: illegal escape sequence
..\utf8.c(4057) : error C2017: illegal escape sequence
..\utf8.c(4057) : error C2017: illegal escape sequence
..\utf8.c(4057) : error C2017: illegal escape sequence
..\utf8.c(4057) : error C2143: syntax error : missing ')' before 'string'
..\utf8.c(4057) : error C2017: illegal escape sequence
..\utf8.c(4057) : error C2017: illegal escape sequence
..\utf8.c(4057) : error C2017: illegal escape sequence
..\utf8.c(4057) : error C2059: syntax error : ')'
..\utf8.c(4057) : error C2059: syntax error : ')'
..\utf8.c(4057) : error C2059: syntax error : ')'
..\utf8.c(4057) : error C2017: illegal escape sequence
..\utf8.c(4057) : fatal error C1013: compiler limit : too many open
parentheses
GNUmakefile:1439: recipe for target 'mini\utf8.obj' failed
The VC6 C preprocessor breaks down and messes up the number of \s
in escaping asserts in asserts in asserts to make a double quote string
litteral for an assert message. VC7/VC 2003 doesn't have this problem.
Fix the asserts in asserts by factoring out EIGHT_BIT_UTF8_TO_NATIVE
macro which has asserts inside it from L1_func aka toFOLD_LC which is
another macro that has asserts inside it.
Some adtl details in RT ticket associated with the patch.
---
utf8.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/utf8.c b/utf8.c
index 94e3267..f7b9638 100644
--- a/utf8.c
+++ b/utf8.c
@@ -3881,13 +3881,12 @@ S_check_and_deprecate(pTHX_ const U8 *p,
} \
} \
else if UTF8_IS_NEXT_CHAR_DOWNGRADEABLE(p, e) { \
+ U8 c = EIGHT_BIT_UTF8_TO_NATIVE(*p, *(p+1)); \
if (flags & (locale_flags)) { \
- result = LC_L1_change_macro(EIGHT_BIT_UTF8_TO_NATIVE(*p, \
- *(p+1))); \
+ result = LC_L1_change_macro(c); \
} \
else { \
- return L1_func(EIGHT_BIT_UTF8_TO_NATIVE(*p, *(p+1)), \
- ustrp, lenp, L1_func_extra_param); \
+ return L1_func(c, ustrp, lenp, L1_func_extra_param); \
} \
} \
else { /* malformed UTF-8 or ord above 255 */ \
--
2.5.0.windows.1
|
From @bulk88UV (void) ((p) || (_assert("p", "..\\utf8.c", 4047), 0)); (void) ((!((flags & 0x1) && (flags & 0x4))) (void) ((p != ustrp) || (_assert("p != ustrp", "..\\utf8.c", 4052), 0)); if (flags & (0x1)) { result = if (flags & 0x1) { if ((((sizeof("\xE1\xBA\x9E") - 1) == (PL_utf8skip[*(const U8 *) (p)])) Perl_ck_warner((63), if ((((sizeof("\xEF\xAC\x85") - 1) == (PL_utf8skip[*(const U8 *) (p)])) Perl_ck_warner((63), return S_check_locale_boundary_crossing(p, result, ustrp, lenp); UV original; U8 * s = ustrp; original = Perl_valid_utf8_to_uvchr(p, lenp); if (original == 0xDF || original == 0x1E9E ) { ((void) return result; if (((U64) (((result) | 0) | 0) < 128)) { return result; return_long_s: *lenp = 2 * sizeof("\xC5\xBF") - 2; ((void) return_ligature_st: *lenp = sizeof("\xEF\xAC\x86") - 1; } |
From @bulk88[CASE_CHANGE_BODY_START macro bug.PNG](https://rt-archive.perl.org/perl5/Ticket/Attachment/1545334/819882/CASE_CHANGE_BODY_START macro bug.PNG) |
From @khwilliamsonThanks, applied as 1a75116 EIGHT_BIT_UTF8_TO_NATIVE is not documented because it's too low level to encourage others to use. But the name is supposed to signify that it fits in a U8 |
The RT System itself - Status changed from 'new' to 'open' |
@khwilliamson - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#133088 (status was 'resolved')
Searchable as RT133088$
The text was updated successfully, but these errors were encountered: