Skip to content

attempt to add with overflow when using MultiProgress with hidden target #602

@cvijdea-bd

Description

@cvijdea-bd

Describe the bug
It seems that indicatif::multi::MultiState::draw panic with overflow in debug mode, at line 301 line_count is usize::MAX because width is 0.

thread 'fuzz' panicked at %USERPROFILE%\.cargo\git\checkouts\indicatif-f02645b5057a6299\a7456f6\src\multi.rs:305:13:
attempt to add with overflow
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/4578435e1695863d921c7763d5a0add98f8e3869/library\std\src\panicking.rs:597
   1: core::panicking::panic_fmt
             at /rustc/4578435e1695863d921c7763d5a0add98f8e3869/library\core\src\panicking.rs:72
   2: core::panicking::panic
             at /rustc/4578435e1695863d921c7763d5a0add98f8e3869/library\core\src\panicking.rs:127
   3: indicatif::multi::MultiState::draw
             at %USERPROFILE%\.cargo\git\checkouts\indicatif-f02645b5057a6299\a7456f6\src\multi.rs:301
   4: indicatif::multi::MultiState::suspend<[redacted],tuple$<> >
             at %USERPROFILE%\.cargo\git\checkouts\indicatif-f02645b5057a6299\a7456f6\src\multi.rs:392
   5: indicatif::multi::MultiProgress::suspend<[redacted],tuple$<> >
             at %USERPROFILE%\.cargo\git\checkouts\indicatif-f02645b5057a6299\a7456f6\src\multi.rs:187
   [...]

To Reproduce

let multibar = MultiProgress::with_draw_target(ProgressDrawTarget::hidden());
multibar.suspend(|| println!("crash"));

Expected behavior
No crash

Additional context
Using latest commit a7456f6 from git master.

Metadata

Metadata

Assignees

No one assigned

    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