Tcl Source Code

Check-in [0a318e4eb4]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add some test-cases with longer backslash sequences, to test for internal buffer overflows.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | core-8-branch
Files: files | file ages | folders
SHA3-256: 0a318e4eb403e9b2bb17c06c35ab0cf5c66b39e176bb0fa95dfa587c7c41b7f6
User & Date: jan.nijtmans 2019-03-22 20:44:36.986
Context
2019-03-24
13:02
Make all internal small buffer related to Tcl_UtfBackslash() length 4, not TCL_UTF_MAX: For TCL_UTF_... check-in: 69cd13225a user: jan.nijtmans tags: core-8-branch
2019-03-22
20:44
Add some test-cases with longer backslash sequences, to test for internal buffer overflows. check-in: 0a318e4eb4 user: jan.nijtmans tags: core-8-branch
15:08
lots of changes to the "info" page. Replace "command procedure" with "routine" in Tcl.n. check-in: c78313c4f3 user: pooryorick tags: core-8-branch
Changes
Unified Diff Ignore Whitespace Patch
Changes to tests/utf.test.
184
185
186
187
188
189
190






191
192
193
194
195
196
197
    expr {"\u4e21" eq [testbytestring "\xe4\xb8\xa1"]}
} 1
test utf-10.4 {Tcl_UtfBackslash: stops at first non-hex} testbytestring {
    expr {"\u4e2k" eq "[testbytestring \xd3\xa2]k"}
} 1
test utf-10.5 {Tcl_UtfBackslash: stops after 4 hex chars} testbytestring {
    expr {"\u4e216" eq "[testbytestring \xe4\xb8\xa1]6"}






} 1
proc bsCheck {char num} {
    global errNum
    test utf-10.$errNum {backslash substitution} {
	scan $char %c value
	set value
    } $num







>
>
>
>
>
>







184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
    expr {"\u4e21" eq [testbytestring "\xe4\xb8\xa1"]}
} 1
test utf-10.4 {Tcl_UtfBackslash: stops at first non-hex} testbytestring {
    expr {"\u4e2k" eq "[testbytestring \xd3\xa2]k"}
} 1
test utf-10.5 {Tcl_UtfBackslash: stops after 4 hex chars} testbytestring {
    expr {"\u4e216" eq "[testbytestring \xe4\xb8\xa1]6"}
} 1
test utf-10.6 {Tcl_UtfBackslash: stops after 5 hex chars} testbytestring {
    expr {"\U1e2165" eq "[testbytestring \xf0\x9e\x88\x96]5"}
} 1
test utf-10.6 {Tcl_UtfBackslash: stops after 6 hex chars} testbytestring {
    expr {"\U10e2165" eq "[testbytestring \xf4\x8e\x88\x96]5"}
} 1
proc bsCheck {char num} {
    global errNum
    test utf-10.$errNum {backslash substitution} {
	scan $char %c value
	set value
    } $num
Changes to tests/util.test.
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
    # pattern += Tcl_UtfToUniChar(pattern, &endChar);
    # get 1 UTF-8 character
    Wrapper_Tcl_StringMatch "a\[a\u4e4fc]c" "a\u4e4fc"
} 1
test util-5.18 {Tcl_StringMatch: UTF-8} testbytestring {
    # pattern += Tcl_UtfToUniChar(pattern, &endChar);
    # proper advance: wrong answer would match on UTF trail byte of \u4e4f
    Wrapper_Tcl_StringMatch {a[a\u4e4fc]c} [testbytestring a\u008fc]
} 0
test util-5.19 {Tcl_StringMatch: UTF-8} {
    # pattern += Tcl_UtfToUniChar(pattern, &endChar);
    # proper advance.
    Wrapper_Tcl_StringMatch {a[a\u4e4fc]c} "acc"
} 1
test util-5.20 {Tcl_StringMatch} {







|







278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
    # pattern += Tcl_UtfToUniChar(pattern, &endChar);
    # get 1 UTF-8 character
    Wrapper_Tcl_StringMatch "a\[a\u4e4fc]c" "a\u4e4fc"
} 1
test util-5.18 {Tcl_StringMatch: UTF-8} testbytestring {
    # pattern += Tcl_UtfToUniChar(pattern, &endChar);
    # proper advance: wrong answer would match on UTF trail byte of \u4e4f
    Wrapper_Tcl_StringMatch {a[a\u4e4fc]c} [testbytestring a\x8fc]
} 0
test util-5.19 {Tcl_StringMatch: UTF-8} {
    # pattern += Tcl_UtfToUniChar(pattern, &endChar);
    # proper advance.
    Wrapper_Tcl_StringMatch {a[a\u4e4fc]c} "acc"
} 1
test util-5.20 {Tcl_StringMatch} {