auto merge of #17195 : tbu-/rust/pr_strfindoverflow2, r=alexcrichton

This commit is contained in:
bors 2014-09-14 10:36:08 +00:00
commit 21d1f4d7c0

View File

@ -574,6 +574,9 @@ enum Searcher {
impl Searcher { impl Searcher {
fn new(haystack: &[u8], needle: &[u8]) -> Searcher { fn new(haystack: &[u8], needle: &[u8]) -> Searcher {
// FIXME: Tune this. // FIXME: Tune this.
// FIXME(#16715): This unsigned integer addition will probably not
// overflow because that would mean that the memory almost solely
// consists of the needle. Needs #16715 to be formally fixed.
if needle.len() + 20 > haystack.len() { if needle.len() + 20 > haystack.len() {
Naive(NaiveSearcher::new()) Naive(NaiveSearcher::new())
} else { } else {