Skip to content

Thread integer overflow #16

Closed
Closed

Description

@rhettjay

Hit a panic: integer overflow running on Apple M1 Pro (zig 0.13.0)

thread 29789858 panic: integer overflow
/Users/quigon/sandbox/DOOM-fire-zig/src/main.zig:534:31: 0x10232103f in paintBuf (DOOM-fire)
        bs_sz_avg = bs_sz_avg * (bs_frame_tic - 1) / bs_frame_tic + bs_len / bs_frame_tic;
                              ^
/Users/quigon/sandbox/DOOM-fire-zig/src/main.zig:677:17: 0x1022fb4a3 in showDoomFire (DOOM-fire)
        paintBuf();
                ^
/Users/quigon/sandbox/DOOM-fire-zig/src/main.zig:695:17: 0x1022f8d3b in main (DOOM-fire)
    showDoomFire();
                ^
/opt/homebrew/Cellar/zig/0.13.0/lib/zig/std/start.zig:524:37: 0x1022f89d3 in main (DOOM-fire)
            const result = root.main() catch |err| {
                                    ^
???:?:?: 0x19476b153 in ??? (???)
???:?:?: 0xf65affffffffffff in ??? (???)
run
└─ run DOOM-fire failure
error: the following command terminated unexpectedly:
/Users/quigon/sandbox/DOOM-fire-zig/zig-out/bin/DOOM-fire
Build Summary: 3/5 steps succeeded; 1 failed (disable with --summary none)
run transitive failure
└─ run DOOM-fire failure
error: the following build command failed with exit code 1:
/Users/quigon/sandbox/DOOM-fire-zig/.zig-cache/o/67782a5dc412ad16b42c77c1fa5bc802/build /opt/homebrew/Cellar/zig/0.13.0/bin/zig /Users/quigon/sandbox/DOOM-fire-zig /Users/quigon/sandbox/DOOM-fire-zig/.zig-cache /Users/quigon/.config/cache/zig --seed 0x59836f02 -Zc60d731a387bf85b run

Activity

  1. const-void commented on Dec 15, 2024

    @const-void
    Owner

    A fix for large displays has just been merged...could you try refreshing and seeing if the error continues?

  2. tml-adobe commented on Jan 1, 2025

    @tml-adobe

    Still crashes for me. Display (LG UltraFine): 3840x2160 @ 60 Hz in 27"

  3. tml-adobe commented on Jan 1, 2025

    @tml-adobe

    This, however, seems to fix it:

    index 69ac5a6..4b5b166 100644
    --- a/src/main.zig
    +++ b/src/main.zig
    @@ -474,12 +474,12 @@ const px = "▀";
     
     //bs = buffer string
     var bs: []u8 = undefined;
    -var bs_idx: u32 = 0;
    -var bs_len: u32 = 0;
    -var bs_sz_min: u32 = 0;
    -var bs_sz_max: u32 = 0;
    -var bs_sz_avg: u32 = 0;
    -var bs_frame_tic: u32 = 0;
    +var bs_idx: u64 = 0;
    +var bs_len: u64 = 0;
    +var bs_sz_min: u64 = 0;
    +var bs_sz_max: u64 = 0;
    +var bs_sz_avg: u64 = 0;
    +var bs_frame_tic: u64 = 0;
     var t_start: i64 = 0;
     var t_now: i64 = 0;
     var t_dur: f64 = 0.0;
  4. const-void commented on Jan 1, 2025

    @const-void
    Owner

    nice patch!

  5. self-assigned this
    on Jan 1, 2025
  6. linked a pull request that will close this issuefeat: x64 memory (c/o u64) #21on Jan 1, 2025
  7. const-void commented on Jan 1, 2025

    @const-void
    Owner

    @rhettjay - hopefully this does the trick! Please close this issue if this fixes your problem!

  8. rhettjay commented on Jan 7, 2025

    @rhettjay
    Author

    Sorry the delay and missing the earlier request for trying. That seems to have fixed that issue. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions