-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Panic in src/archive/mode.rs:163 #328
Comments
Thanks for fuzzing, I love that! I’m a bit busy but I’ll begin triage on issues little later this week, however for particular case of from_utf8 this is available in core: https://doc.rust-lang.org/stable/core/str/fn.from_utf8.html so that should allow your suggested fix to work in no std environment :) |
Well, I Iooked. This function does validation of utf8 strings in std. We could put this code in I think, first way is more suitable. But also it would be great to put some docs for |
Actually taking a second look here, I'm a little bit confused what the issue is? Specifically, scroll::Pread on an &str uses this implementation: (i.e., it calls ::from_ut8 for you). Could you attach your full stack trace? There shouldn't be any panicking at all here, since the error should be propagated down to the callee (and the unwrap shouldn't be a utf8 error unwrap in core str, since we rewrap that error in scroll to BadInput) |
Hmm, that's weird... Here is the stack trace
I also, attach the input |
Hi @m4b while working on #334 found a similar panic. crash-1999fa19815adfa202569abdb7fcf1e06b945fe3.txt fn main() {
let data = std::fs::read("./crash-1999fa19815adfa202569abdb7fcf1e06b945fe3.txt").unwrap();
let _ = goblin::Object::parse(&data);
}
|
I think this is due to the line here directly indexing into the name str without previously validating the byte indexes. In some cases, this could split a multibyte codepoint, so it wouldn't be able to return a str and panics instead. I think this line could be replaced with if name.len() > 3 && name.get(0..3) == Some("#1/") { to work around the issue. |
Ok sounds good let’s do it! |
Hi!
We were doing some fuzzing with libFuzzer and our tool Sydr and we found some issues. Here is the panic message:
thread 'main' panicked at 'byte index 3 is not a char boundary; it is inside 'Г' (bytes 2..4) of
00Г00', library/core/src/str/mod.rs:127:5
. The problem is because we try to build utf-8 str from non-utf8 characters here. The obvious fix is to use:But goblin is std-free. Do you have any ideas?
Btw, we use goblin in our tools (sydr-fuzz, casr). It is very nice crate:).
The text was updated successfully, but these errors were encountered: