about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-01-28 13:31:51 +0000
committerbors <bors@rust-lang.org>2022-01-28 13:31:51 +0000
commit8d5d9e01037b841ca9ae9add09cdf4ada12a0fae (patch)
tree369d700246fcfdb4494835a5fb050d5d1c2bf3de /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parentfb94992c39e64c280ccb21299509aee767ebd6d9 (diff)
parent23fd95a5e99acf35b471ca9b01230d7578bfac5f (diff)
downloadrust-8d5d9e01037b841ca9ae9add09cdf4ada12a0fae.tar.gz
rust-8d5d9e01037b841ca9ae9add09cdf4ada12a0fae.zip
Auto merge of #8250 - pr2502:fix_repeat_underflow, r=giraffate
Fix underflow in `manual_split_once` lint

Hi, a friend found clippy started crashing on a suspiciously large allocation of `u64::MAX` memory on their code.

The mostly minimized repro is:
```rust
fn _f01(title: &str) -> Option<()> {
    let _ = title[1..].splitn(2, '[').next()?;
    Some(())
}
```

The underflow happens in this case on line 57 of the patch but I've changed the other substraction to saturating as well since it could potentially cause the same issue.

I'm not sure where to put a regression test, or if it's even worth for such a thing.

Aside, has it been considered before to build clippy with overflow checks enabled?

changelog: fix ICE of underflow in `manual_split_once` lint
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions