-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Open
Description
Description
runtime/src/coreclr/vm/methodtablebuilder.cpp
Line 1054 in cc4dadd
bmtParent->pSlotTable = new (GetStackingAllocator()) |
UnsafeAllocNoThrow() is a chamber of horrors.
- It returns a cast -1 when the number of things requested is 0, which happens. (Perhaps this in itself is a bug.)
- -1 is not aligned to 0 mod 16. It also has the magic number "7" in the code, which should really be the desired alignment (a power of 2) -1. (The code now assumes the caller is happy with alignment of 8 bytes.)
Reproduction Steps
compile with clang-14 -g -O0 -fsanitize=undefined; run the code,; and wait for runtime errors.
Expected behavior
no runtime errors
Actual behavior
runtime errors from ubsan
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
cc / @AaronRobinsonMSFT