Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/coreclr/inc/corinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -2377,7 +2377,11 @@ class ICorStaticInfo
CORINFO_RESOLVED_TOKEN * pResolvedToken /* IN */) = 0;

// Returns (sub)string length and content (can be null for dynamic context)
// for given metaTOK and module, length `-1` means input is incorrect
// for given metaTOK and module, length `-1` means input is incorrect.
//
// Return value: The actual length of the string literal. Note that this may be larger
Comment thread
jkotas marked this conversation as resolved.
Outdated
// than bufferSize, in which case only bufferSize characters are copied to buffer.
// The caller should use min(returnValue, bufferSize) when working with the buffer.
Comment thread
jkotas marked this conversation as resolved.
Outdated
virtual int getStringLiteral (
CORINFO_MODULE_HANDLE module, /* IN */
unsigned metaTOK, /* IN */
Expand Down
4 changes: 3 additions & 1 deletion src/coreclr/jit/eeinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,9 @@ void Compiler::eePrintStringLiteral(CORINFO_MODULE_HANDLE module, unsigned token
else
{
char dst[MAX_LITERAL_LENGTH];
convertUtf16ToUtf8ForPrinting(str, length, dst, MAX_LITERAL_LENGTH);
// Truncate length to MAX_LITERAL_LENGTH since that's the maximum we copied into str
int truncatedLength = min(length, MAX_LITERAL_LENGTH);
convertUtf16ToUtf8ForPrinting(str, truncatedLength, dst, MAX_LITERAL_LENGTH);
Comment thread
jkotas marked this conversation as resolved.
Outdated
printf("\"%.50s%s\"", dst, length > 50 ? "..." : "");
}
}
Expand Down
Loading