mirror of
https://github.com/sharkdp/bat
synced 2024-11-24 04:43:07 +00:00
fix: integer overflow in LineRange::parse_range
This commit is contained in:
parent
8e35a56712
commit
9fcc57e496
1 changed files with 1 additions and 1 deletions
|
@ -53,7 +53,7 @@ impl LineRange {
|
|||
let more_lines = &line_numbers[1][1..]
|
||||
.parse()
|
||||
.map_err(|_| "Invalid character after +")?;
|
||||
new_range.lower + more_lines
|
||||
new_range.lower.saturating_add(*more_lines)
|
||||
} else if first_byte == Some(b'-') {
|
||||
// this will prevent values like "-+5" even though "+5" is valid integer
|
||||
if line_numbers[1][1..].bytes().next() == Some(b'+') {
|
||||
|
|
Loading…
Reference in a new issue