-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stack_probe.zig causing segmentation fault in Debug Mode #17195
Comments
This could possibly be a duplicate of this issue But that issue doesn't mention this section of the std lib causing a segmentation fault, so this might be a separate issue |
@VisenDev |
@arnthorla For me, changing some fields in a struct to pointers to values instead of the values themselves seemed to fix the segmentation faults with |
Thanks @VisenDev |
@VisenDev What's the size of |
I think I may have found the issue. Repro: const std = @import("std");
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const ally = gpa.allocator();
const Big = struct {
array: [100_000_000]u8 = undefined,
};
const Small = struct {
value: u8,
big: *Big,
};
pub fn main() !void {
_ = try std.json.parseFromSlice(Small, ally, "{ \"value\": 123, \"big\": {} }", .{});
} Even though Line 447 in cb308ba
This may possibly change when #8824 is implemented. Do you think the issue described above might be the reason of your stack overflow too? If so, I suggest editing the title to refer to this instead of the part related to #7371. |
Duplicate of #7371 |
Zig Version
0.11.0
Steps to Reproduce and Observed Behavior
stack_probe.zig is causing a segmentation fault when in debug mode. Here is one instance where this happened
This stack segmentation fault is also happening when attempting to parse large json strings using std.json.parseFromSlice
Example code causing a segfault. level.Level is a large struct.
When the code is compiled in modes other than debug, the segmentation fault does not happen
Expected Behavior
No segmentation fault
The text was updated successfully, but these errors were encountered: