-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
std.io.GenericReader.readAllArrayList panics when error.OutOfMemory #18539
Copy link
Copy link
Closed
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavior
Description
Zig Version
0.12.0-dev.2059+42389cb9c
Steps to Reproduce and Observed Behavior
const std = @import("std");
test {
var stream = std.io.fixedBufferStream("Hello, world!");
const reader = stream.reader();
std.testing.failing_allocator_instance.fail_index = 0;
var arr = std.ArrayList(u8).init(std.testing.failing_allocator);
defer arr.deinit();
try std.testing.expectError(
error.OutOfMemory,
reader.readAllArrayList(&arr, std.math.maxInt(usize)),
);
}$ zig test foo.zig
Test [1/1] test_0... thread 1987543 panic: invalid error code
/home/gcoakes/.local/share/zig-linux-x86_64-0.12.0-dev.2059+42389cb9c/lib/std/io.zig:146:58: 0x1029156 in test_0 (test)
return @errorCast(self.any().readAllArrayList(array_list, max_append_size));
^
/home/gcoakes/.local/share/zig-linux-x86_64-0.12.0-dev.2059+42389cb9c/lib/test_runner.zig:181:28: 0x103640d in mainTerminal (test)
} else test_fn.func();
^
/home/gcoakes/.local/share/zig-linux-x86_64-0.12.0-dev.2059+42389cb9c/lib/test_runner.zig:36:28: 0x102c12a in main (test)
return mainTerminal();
^
/home/gcoakes/.local/share/zig-linux-x86_64-0.12.0-dev.2059+42389cb9c/lib/std/start.zig:575:22: 0x102a12c in posixCallMainAndExit (test)
root.main();
^
/home/gcoakes/.local/share/zig-linux-x86_64-0.12.0-dev.2059+42389cb9c/lib/std/start.zig:253:5: 0x1029c81 in _start (test)
asm volatile (switch (native_arch) {
^
???:?:?: 0x0 in ??? (???)
error: the following test command crashed:
/home/gcoakes/src/zig-cbor/zig-cache/o/48b3dd4ab42bd9ceee7ad690832d0c82/testExpected Behavior
It should return error.OutOfMemory.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavior