Skip to content

Commit 921f508

Browse files
authored
Merge pull request #27070 from jckarter/compatibility-hook-high-bit-5.1-08-28-2019
[5.1] Compatibility50: Fix for high-bit characters.
2 parents ae392b2 + 2ec5035 commit 921f508

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

stdlib/toolchain/Compatibility50/Overrides.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ getObjCClassByMangledName_untrusted(const char * _Nonnull typeName,
5454
// Scan the string for byte sequences that might be recognized as
5555
// symbolic references, and reject them.
5656
for (const char *c = typeName; *c != 0; ++c) {
57-
if (*c < 0x20) {
57+
if (*c >= 1 && *c < 0x20) {
5858
*outClass = Nil;
5959
return NO;
6060
}

test/Interpreter/SDK/objc_getClass.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ testSuite.test("Basic")
150150
requireClass(named: "main.ObjCSuperclass")
151151
}
152152

153+
class Çlass<T> {}
154+
class SubÇlass: Çlass<Int> {}
155+
153156
testSuite.test("BasicMangled")
154157
.requireOwnProcess()
155158
.code {
@@ -188,6 +191,10 @@ testSuite.test("GenericMangled")
188191
demangledName: "main.ConstrainedObjCSubclass")
189192
requireClass(named: "_TtC4main25ConstrainedObjCSuperclass",
190193
demangledName: "main.ConstrainedObjCSuperclass")
194+
195+
// Make sure we don't accidentally ban high-bit characters.
196+
requireClass(named: "_TtC4main9SubÇlass", demangledName: "main.SubÇlass")
197+
requireClass(named: "4main9SubÇlassC", demangledName: "main.SubÇlass")
191198
}
192199

193200
testSuite.test("ResilientSubclass")

0 commit comments

Comments
 (0)