weird llvm opt bug?

master
Avril 4 years ago
parent 218d9747c3
commit 50af84cc58
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -10,7 +10,8 @@ edition = "2018"
async = ["tokio"]
[profile.release]
opt-level = 3
opt-level = 1 # opt-level >1 causes strange bug in regards to size of memory map??? it still happens on one just not as much????
# To test map a large file in /tmp a bunch of times and hash it.
lto = "fat"
codegen-units = 1
@ -21,4 +22,4 @@ tokio = {version = "0.2", features= ["full"], optional=true}
reqwest = {version = "0.10", features= ["stream"]}
memmap = "0.7"
getrandom = "0.1"
base64 = "0.12"
base64 = "0.12"

@ -4,3 +4,6 @@ Remove Cargo.lock when termprogress is uploaded and Cargo.toml is properly forma
New UI:
lolistealer --number 5 output-dir/
!!! memmap slice size is incorrect on release build

@ -91,7 +91,7 @@ fn find_back(haystack: &[u8], needle: &[u8]) -> Option<usize> {
}
const MARKER_BASE64_BEGIN: &[u8] = b"base64,";
const MARKER_BASE64_END: &[u8] = b"' />"; //Search from end here with .rev()
const MARKER_BASE64_END: &[u8] = b"' /><p"; //Search from end here with .rev()
/// Find the base64 page bounds in this array
pub(super) fn find_bounds(from: impl AsRef<[u8]>) -> Result<Range<usize>, error::DecodeError>
@ -102,11 +102,15 @@ pub(super) fn find_bounds(from: impl AsRef<[u8]>) -> Result<Range<usize>, error:
let start = start + MARKER_BASE64_BEGIN.len();
if let Some(end) = find_back(&from[start..], MARKER_BASE64_END) {//find_back(from, MARKER_BASE64_END) {
let end = end - MARKER_BASE64_END.len();
return Ok(Range {
Ok(Range {
start,
end: end + start,
});
})
} else {
//println!("WAAAAAAH: {:?}", std::str::from_utf8(&from[start..]));
Err(error::DecodeError::Bounds(error::Bound::End))
}
} else {
Err(error::DecodeError::Bounds(error::Bound::Start))
}
Err(error::DecodeError::Bounds)
}

@ -5,6 +5,14 @@ use std::{
path::PathBuf,
};
/// Start or end bounds
#[derive(Debug)]
pub enum Bound
{
Start,
End,
}
#[derive(Debug)]
pub enum DecodeError
{
@ -15,7 +23,7 @@ pub enum DecodeError
/// Map contained invalid base64
Base64,
/// Couldn't find base64 bounds
Bounds,
Bounds(Bound),
/// Bad size
Size,
}
@ -38,7 +46,8 @@ impl fmt::Display for DecodeError
Self::Map(io, path) => write!(f, "mmap (file {:?}) failed: {}", path, io),
Self::Corrupt => write!(f, "data was corrupt (invalid utf-8)"),
Self::Base64 => write!(f, "data was corrupt (invalid base64)"),
Self::Bounds => write!(f, "couldn't find base64 bounds"),
Self::Bounds(Bound::Start) => write!(f, "couldn't find base64 bounds (start)"),
Self::Bounds(Bound::End) => write!(f, "couldn't find base64 bounds (end)"),
Self::Size => write!(f, "bad size"),
}
}

Loading…
Cancel
Save