Closed
Description
Description
Compiling on/for x64 architecture on linux with clang-14.
The function CMiniMdBase::InitColsForTable
runtime/src/coreclr/md/runtime/metamodel.cpp
Line 720 in 9bd2cb5
allocates an automatic array variable of CMiniColDef[9]. The base address of this array is passed down through UsesAllocatedMemory(). UsesAllocatedMemory apparently implements some kind of marking of the preceding byte to determine if the block was obtained from a memory allocator.
But in this case, the block is an automatic in some nearby frame. In our case, the preceding bytes contain a pointer pTemplate. Uses AllocatedMemory reads a byte from that pointer, which one depends on endianness.
You can't do thatt.
Reproduction Steps
Compile with -fsanitize=address and stop at first fail.
Expected behavior
no errors detected by asan
Actual behavior
Read an adjacent memory location.
Regression?
No response
Known Workarounds
Probably put a dummy slot in the frame before the [9] vector to emulate what's done when those CMiniColDefs are allocated dynamically.
Configuration
No response
Other information
No response