Skip to content

Commit 3c45a94

Browse files
committed
Value: fix out-of-bounds slice access writing zero-bit undef value
I have no idea why this wasn't being hit on master before.
1 parent 03ad862 commit 3c45a94

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Value.zig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,9 @@ pub fn writeToPackedMemory(
469469
const endian = target.cpu.arch.endian();
470470
if (val.isUndef(mod)) {
471471
const bit_size: usize = @intCast(ty.bitSize(mod));
472-
std.mem.writeVarPackedInt(buffer, bit_offset, bit_size, @as(u1, 0), endian);
472+
if (bit_size != 0) {
473+
std.mem.writeVarPackedInt(buffer, bit_offset, bit_size, @as(u1, 0), endian);
474+
}
473475
return;
474476
}
475477
switch (ty.zigTypeTag(mod)) {

0 commit comments

Comments
 (0)