Skip to content

Arithmetic overflow occurs while using API LineRange::from() #2674

@HeeillWang

Description

@HeeillWang

What steps will reproduce the bug?
I executed fuzz testing with bat public APIs and found crash case.

let fuzz_arg1 = "18446744073709551615:+1";
LineRange::from(fuzz_arg1);

What happens?

Thread '<unnamed>' panicked at 'attempt to add with overflow', /rustc/871b5952023139738f72eba235063575062bc2e9/library/core/src/ops/arith.rs:109

The overflow occurs with this statement :

new_range.lower + more_lines

What did you expect to happen instead?
Need assertion to prevent arith overflow, or need to explicitly mention panic condition.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions