Skip to content

Commit 16fea29

Browse files
committed
sf.net # 795 : unsupported \UNNNN escape sequence is miscompiled
- escape codepoints > 0xFFFF with "\Unnnnnnnn" - preserve "\Unnnnnnnn" escape sequences where code point > 0xFFFF - expect "\Unnnnnnnn" escape to have 8 hex digits - warn when "\u" or "\U" escape sequences are invalid or truncated - add capability to return a warning from hReEscape() and hReEscapeW() - internal - order of functions in src/compiler/hlp-str.bas - "\Unnnnnnnn" escape sequence is mapped as follows: when within unicode BMP, "\unnnn", otherwise on linux "\Unnnnnnnn", or on windows "\uD8XX\uDCXX" surrogate pair.
1 parent 4e5f625 commit 16fea29

File tree

9 files changed

+434
-230
lines changed

9 files changed

+434
-230
lines changed

changelog.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ Version 1.20.0
2626
- fbc: set bit value '__FB_ERR__' = &h400 if '-earraydims' is enabled
2727
- PEEK, POKE, and SWAP are now quirk words instead of keywords allowing these names to be used as member procedure names
2828
- fbdoc: change CRegex.bas to use pcre2 since the libpcre (a.k.a pcre3) is obsolete in favour of pcre2 by upstream (Ahmad Khalifa)
29+
- PEEK, POKE, and SWAP are now quirk words instead of keywords allowing these names to be used as member procedure names
30+
- "\Unnnnnnnn" escape sequence is mapped as follows: when within unicode BMP, "\unnnn", otherwise on linux "\Unnnnnnnn", or on windows "\uD8XX\uDCXX" surrogate pair.
2931

3032
[added]
3133
- x86_64: optimize SHL MOD INTDIV to use 32-bit operation when result will be converted to long/ulong
@@ -66,6 +68,7 @@ Version 1.20.0
6668
- '-earraydims' command line option to enable array dimensions checking. Enabled by default with '-exx' command line option.
6769
- github #426: add __FB_ARG_LISTEXPAND__( macroname, macroargcount, args... ): expands to one or more 'macroname( .... )' depending on the value of macroargcount and number of arguments in the args... list (skyfish)
6870
- fbc: command line option '-z optabstract' to support optimizing purely abstract types, and only preserve used pure abstract types (skyfish)
71+
- fbc: warning when "\u" or "\U" escape sequences are invalid or truncated
6972

7073
[fixed]
7174
- github #410: give consistent floating point comparisons results involving NaNs.
@@ -100,7 +103,8 @@ Version 1.20.0
100103
- gas64: fix casting ulong (with "negative value") to double/single (SARG)
101104
- gas64: fix optimization prevented converting 32bit memory/register (SARG)
102105
- fbc: #cmdline "-end" was not resetting the parser, hiding errors and producing a bad executable
103-
- sf.net #1009: Invalid symbol when accessing indexed PROPERTY arrays BYREF
106+
- sf.net #1009: Invalid symbol when accessing indexed PROPERTY arrays BYREF
107+
- sf.net #795: unsupported \UNNNN escape sequence is miscompiled - expect "\Unnnnnnnn" escape to have 8 digits
104108

105109

106110
Version 1.10.3

src/compiler/error.bas

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ declare function hMakeParamDesc _
9494
( /'FB_WARNINGMSG_UPCASTDISCARDSINITIALIZER '/ 1, @"Up-casting discards initializer(s)" ), _
9595
( /'FB_WARNINGMSG_BYREFTEMPVAR '/ 2, @"Suspicious address expression passed to BYREF parameter" ), _
9696
( /'FB_WARNINGMSG_MISSINGANDROIDSYSROOT '/ 1, @"GCC/Clang didn't provide a proper sysroot. You probably have to pass fbc an argument of the form '-sysroot $NDK/platforms/android-$API/arch-$ARCH'" ), _
97+
( /'FB_WARNINGMSG_INVALIDUNICODESEQUENCE '/ 2, @"Invalid or truncated unicode escape sequence" ), _
98+
( /'FB_WARNINGMSG_SURROGATEPAIR '/ 1, @"Surrogate or surrogate pair in unicode literal" ), _
9799
( /'FB_WARNINGMSGS '/ 0, @"FB_WARNINGMSGS" ) _
98100
}
99101

src/compiler/error.bi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,8 @@ enum FB_WARNINGMSG
392392
FB_WARNINGMSG_UPCASTDISCARDSINITIALIZER
393393
FB_WARNINGMSG_BYREFTEMPVAR
394394
FB_WARNINGMSG_MISSINGANDROIDSYSROOT
395+
FB_WARNINGMSG_INVALIDUNICODESEQUENCE
396+
FB_WARNINGMSG_SURROGATEPAIR
395397

396398
FB_WARNINGMSGS
397399
end enum

src/compiler/hash.bas

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
'' chng: sep/2004 written [v1ctor]
44
'' jan/2005 updated to use real linked-lists [v1ctor]
55

6+
#include once "fb.bi"
67
#include once "hash.bi"
78
#include once "hlp.bi"
89

0 commit comments

Comments
 (0)