Skip to content

Access violation in the JIT while trying to print a long string #121988

@hez2010

Description

@hez2010

When the JIT trying to print a constant string to the jit dump, it can crash with an access violation at GetByteCount if the string is long.

Repro: https://godbolt.org/z/P7Mba6eW8

clrjit.dll!GetByteCount(UTF8Encoding * self, wchar_t * chars, unsigned __int64 count) line 1959
	: D:\runtime\src\native\minipal\utf8.c(1959)
clrjit.dll!minipal_get_length_utf16_to_utf8(const wchar_t * source, unsigned __int64 sourceLength, unsigned int flags) line 2100
	: D:\runtime\src\native\minipal\utf8.c(2100)
clrjit.dll!Compiler::convertUtf16ToUtf8ForPrinting(const char16_t * utf16Src, unsigned __int64 utf16SrcLen, char * utf8Dst, unsigned __int64 utf8DstLen) line 10654
	: D:\runtime\src\coreclr\jit\compiler.cpp(10654)
clrjit.dll!Compiler::eePrintStringLiteral(CORINFO_MODULE_STRUCT_ * module, unsigned int token) line 723
	: D:\runtime\src\coreclr\jit\eeinterface.cpp(723)
clrjit.dll!Compiler::gtDispConst(GenTree * tree) line 12311
	: D:\runtime\src\coreclr\jit\gentree.cpp(12311)
clrjit.dll!Compiler::gtDispLeaf(GenTree * tree, IndentStack * indentStack) line 12425
	: D:\runtime\src\coreclr\jit\gentree.cpp(12425)
clrjit.dll!Compiler::gtDispTree(GenTree * tree, IndentStack * indentStack, const char * msg, bool topOnly, bool isLIR) line 13216
	: D:\runtime\src\coreclr\jit\gentree.cpp(13216)

Not prioritized as it's debug only.

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions