Closed
Description
extern crate flac;
use std::io::{self, Read, Cursor};
use flac::{ByteStream, Stream};
fn main() {
let input = b"\x66\x4c\x61\x43\x04\x30\x30\x30\x00\x00\x00\x00\x30\x30\x30\x30";
let s = Stream::<ByteStream>::from_buffer(input);
if let Ok(mut stream) = s {
let _ = stream.info();
let _ = stream.metadata();
let mut iter = stream.iter();
while iter.next().is_some() {
}
}
}
coreyf@aflstagingmachine ~/afl-flac-staging-area> cargo run --verbose
Fresh strsim v0.3.0
Fresh libc v0.2.5
Fresh regex-syntax v0.2.2
Fresh nom v1.1.0
Fresh rustc-serialize v0.3.16
Fresh gcc v0.3.21
Fresh memchr v0.1.7
Fresh hound v1.1.0
Fresh afl-coverage-plugin v0.0.1 (file:///home/coreyf/afl-flac-staging-area)
Fresh aho-corasick v0.4.0
Fresh regex v0.1.48
Fresh afl-coverage v0.0.1 (file:///home/coreyf/afl-flac-staging-area)
Fresh docopt v0.6.78
Fresh flac v0.1.0
Fresh afl-staging-area v0.1.0 (file:///home/coreyf/afl-flac-staging-area)
Running `target/debug/afl-staging-area`
fatal runtime error: out of memory
Process didn't exit successfully: `target/debug/afl-staging-area` (signal: 4)
Found using afl.rs ✨
Activity
[-]Out of bounds error when parsing bytes[/-][+]Out of memory error when parsing bytes[/+]sourrust commentedon Feb 4, 2016
I've tried this example with and without afl, on master and v0.1.0. Can't seem to reproduce the out of memory error.
edit: tried this with the latest nightly:
can you try the example with the latest nightly just so I can see if crops up again.
frewsxcv commentedon Feb 4, 2016
I can't reproduce it on my Macbook Pro, but on both of my Linux boxes, here's what I get:
Return early from `parser::block_data`
sourrust commentedon Feb 5, 2016
Alright, I believe I fixed or at least put two checks in to prevent the error from happening. It seems that this has more to do with the rust compiler on Linux since the number, 808464432, is valid with it being smaller than the max size of a
usize
. The compiler actually tries to allocate data but ended up returning null. There isn't much I can do about the out of memory error itself besides preventing it from happening.Other issues that brought up:
Let me know if this fixes the issue.
frewsxcv commentedon Feb 8, 2016
Sounds good, thanks!