You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test"pointer to sentinel array free" {
constallocator=@import("std").testing.allocator;
consta=tryallocator.allocSentinel(u8, 2, 0);
deferallocator.free(a[0..2 :0]); // error with invalid free, due to sentinel not being accounted (type is *[2:0]u8)
}
Crashes with:
thread 20107 panic: Invalid free
/home/blockog/zig/lib/std/heap/debug_allocator.zig:870:49: 0x1055dbb in free (test)
if (bucket.canary != config.canary) @panic("Invalid free");
^
/home/blockog/zig/lib/std/mem/Allocator.zig:147:25: 0x10568a3 in free__anon_1623 (test)
return a.vtable.free(a.ptr, memory, alignment, ret_addr);
^
/home/blockog/crash.zig:5:25: 0x1054e6b in test.pointer to sentinel array free (test)
defer allocator.free(a[0..2 :0]); // error with invalid free, due to sentinel not being accounted (type is *[2:0]u8)
^
/home/blockog/zig/lib/compiler/test_runner.zig:214:25: 0x10dcf13 in mainTerminal (test)
if (test_fn.func()) |_| {
^
/home/blockog/zig/lib/compiler/test_runner.zig:62:28: 0x10d7b2b in main (test)
return mainTerminal();
^
/home/blockog/zig/lib/std/start.zig:647:22: 0x10d718b in posixCallMainAndExit (test)
root.main();
^
???:?:?: 0x0 in ??? (???)
Expected Behavior
It should be able to free it just fine
The text was updated successfully, but these errors were encountered:
BlockOG
added
the
bug
Observed behavior contradicts documented or intended behavior
label
Feb 26, 2025
Zig Version
0.14.0-dev.3385+055969b10
Steps to Reproduce and Observed Behavior
Crashes with:
Expected Behavior
It should be able to free it just fine
The text was updated successfully, but these errors were encountered: