Repository navigation
Commit 71ec2e6
committed
test(windows): pin the CRT aligned-block route of the aligned-free wrapper
__wrap__aligned_free hands a block mimalloc did not make back to the CRT.
A block from the CRT's _aligned_malloc starts past the CRT's bookkeeping
header, so its matching deallocator is _aligned_free; plain free receives
an interior pointer. This branch routes such blocks to
__real__aligned_free.
The new Windows-only mem test allocates through __real__aligned_malloc
(the CRT's own allocator under --wrap), asserts mimalloc does not own the
block, frees it through the wrapper by name, and checks errno and
HeapValidate on the process heap. Freeing the interior pointer with plain
free is a bad-free report under ASan; on an uninstrumented heap the free
fails with errno set or the process terminates.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>1 parent 9dca8d2 commit 71ec2e6
1 file changed
Lines changed: 33 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
353 | 354 | | |
354 | 355 | | |
355 | 356 | | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
356 | 385 | | |
357 | 386 | | |
358 | 387 | | |
| |||
1744 | 1773 | | |
1745 | 1774 | | |
1746 | 1775 | | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
1747 | 1780 | | |
1748 | 1781 | | |
1749 | 1782 | | |
| |||
0 commit comments