Skip to content

Commit 9d5e647

Browse files
committed
[JITLink] Fix think-o in handwritten CWrapperFunctionResult -> Error converter.
We need to skip the length field when generating error strings. No test case: This hand-hacked deserializer should be removed in the near future once JITLink can use generic ORC APIs (including SPS and WrapperFunction).
1 parent f453e23 commit 9d5e647

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ Error toError(CWrapperFunctionResult R) {
4040
char *Content = Large ? R.Data.ValuePtr : R.Data.Value;
4141
if (Content[0]) {
4242
HasError = true;
43-
ErrMsg.resize(R.Size - 1);
44-
memcpy(&ErrMsg[0], Content + 1, R.Size - 1);
43+
constexpr unsigned StrStart = 1 + sizeof(uint64_t);
44+
ErrMsg.resize(R.Size - StrStart);
45+
memcpy(&ErrMsg[0], Content + StrStart, R.Size - StrStart);
4546
}
4647
if (Large)
4748
free(R.Data.ValuePtr);

0 commit comments

Comments
 (0)