Skip to content

Commit acdf2e7

Browse files
authored
Merge pull request #27993 from mikeash/typeref-length-skip-fix
[Reflection] Fix length calculation in readTypeRef.
2 parents bd97150 + da71f6b commit acdf2e7

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

stdlib/public/Reflection/TypeRefBuilder.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ RemoteRef<char> TypeRefBuilder::readTypeRef(uint64_t remoteAddr) {
4444
}
4545
}
4646
// TODO: Try using MetadataReader to read the string here?
47-
fputs("invalid type ref pointer\n", stderr);
48-
abort();
47+
48+
// Invalid type ref pointer.
49+
return nullptr;
4950

5051
found_type_ref:
5152
// Make sure there's a valid mangled string within the bounds of the
@@ -57,16 +58,16 @@ RemoteRef<char> TypeRefBuilder::readTypeRef(uint64_t remoteAddr) {
5758
goto valid_type_ref;
5859

5960
if (c >= '\1' && c <= '\x17')
60-
i = i.atByteOffset(4);
61+
i = i.atByteOffset(5);
6162
else if (c >= '\x18' && c <= '\x1F') {
62-
i = i.atByteOffset(PointerSize);
63+
i = i.atByteOffset(PointerSize + 1);
6364
} else {
6465
i = i.atByteOffset(1);
6566
}
6667
}
6768

68-
fputs("unterminated type ref\n", stderr);
69-
abort();
69+
// Unterminated string.
70+
return nullptr;
7071

7172
valid_type_ref:
7273
// Look past the $s prefix if the string has one.

0 commit comments

Comments
 (0)