Skip to content
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

Memory leaks #18

Closed
0xcpu opened this issue Mar 5, 2017 · 1 comment
Closed

Memory leaks #18

0xcpu opened this issue Mar 5, 2017 · 1 comment

Comments

@0xcpu
Copy link

0xcpu commented Mar 5, 2017

Hi,

I'm not sure that this is really a problem, but maybe you'll want to investigate further and user cargo-fuzz to fuzz your crate. :)

cargo-fuzz output:
Fresh rgb v0.5.5 Fresh libc v0.2.21 Fresh gcc v0.3.43 Fresh c_vec v1.2.0 Fresh lodepng v0.13.2 (file:///home/ner0x652/Comp/GitHub/lodepng-rust) Fresh libfuzzer-sys v0.1.0 (https://github.com/rust-fuzz/libfuzzer-sys.git#9d00b47e) Fresh lodepng-fuzz v0.0.1 (file:///home/ner0x652/Comp/GitHub/lodepng-rust/fuzz) Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs Runningtarget/x86_64-unknown-linux-gnu/debug/lodepng -artifact_prefix=artifacts/ corpusINFO: Seed: 2476720331 INFO: Loaded 0 modules (0 guards): Loading corpus dir: corpus INFO: -max_len is not provided, using 64 INFO: A corpus is not provided, starting from an empty corpus #0 READ units: 1 thread '<unnamed>' panicked at 'assertion failed:(left == right)(left:1, right: 0): Image is 1 bytes large (0x0x1), but needs to be 0 (LCT_RGBA, 10)', /home/ner0x652/Comp/GitHub/lodepng-rust/src/lib.rs:610 note: Run with RUST_BACKTRACE=1` for a backtrace.
==18380== ERROR: libFuzzer: deadly signal
#0 0x7faf003f5e09 (/home/ner0x652/Comp/GitHub/lodepng-rust/fuzz/target/x86_64-unknown-linux-gnu/debug/lodepng+0x156e09)
#1 0x7faf002f1b4d (/home/ner0x652/Comp/GitHub/lodepng-rust/fuzz/target/x86_64-unknown-linux-gnu/debug/lodepng+0x52b4d)
#2 0x7faf002f1a9b (/home/ner0x652/Comp/GitHub/lodepng-rust/fuzz/target/x86_64-unknown-linux-gnu/debug/lodepng+0x52a9b)
#3 0x7faf002e71ce (/home/ner0x652/Comp/GitHub/lodepng-rust/fuzz/target/x86_64-unknown-linux-gnu/debug/lodepng+0x481ce)
#4 0x7faeff75788f (/lib/x86_64-linux-gnu/libpthread.so.0+0xf88f)
#5 0x7faeff1bc066 (/lib/x86_64-linux-gnu/libc.so.6+0x35066)
#6 0x7faeff1bd447 (/lib/x86_64-linux-gnu/libc.so.6+0x36447)
#7 0x7faf0032a4a8 (/home/ner0x652/Comp/GitHub/lodepng-rust/fuzz/target/x86_64-unknown-linux-gnu/debug/lodepng+0x8b4a8)

NOTE: libFuzzer has rudimentary signal handlers.
Combine libFuzzer with AddressSanitizer or similar for better crash reports.
SUMMARY: libFuzzer: deadly signal
MS: 0 ; base unit: 0000000000000000000000000000000000000000
0xa,
\x0a
artifact_prefix='artifacts/'; Test unit written to artifacts/crash-adc83b19e793491b1c6ea0fd8b46cd9f32e592fc
Base64: Cg==

=================================================================
==18380==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 3 byte(s) in 3 object(s) allocated from:
#0 0x7faf003e8fbf (/home/ner0x652/Comp/GitHub/lodepng-rust/fuzz/target/x86_64-unknown-linux-gnu/debug/lodepng+0x149fbf)
#1 0x7faf0031622c (/home/ner0x652/Comp/GitHub/lodepng-rust/fuzz/target/x86_64-unknown-linux-gnu/debug/lodepng+0x7722c)

SUMMARY: AddressSanitizer: 3 byte(s) leaked in 3 allocation(s).
MS: 0 ; base unit: 0000000000000000000000000000000000000000
0xa,
\x0a
artifact_prefix='artifacts/'; Test unit written to artifacts/crash-adc83b19e793491b1c6ea0fd8b46cd9f32e592fc
Base64: Cg==`

Started with this:
`#![no_main]
extern crate libfuzzer_sys;
extern crate lodepng;

#[export_name="rust_fuzzer_test_input"]
pub extern fn go(data: &[u8]) {
let _ = lodepng::encode_memory(data, 0, 0, lodepng::ffi::ColorType::LCT_RGBA, 10);
}`

@kornelski
Copy link
Owner

Unfortunately I don't have any Linux machine with enough RAM to run the fuzzer.

I can't fix it without knowing line of code that's responsible, but the report is for executable without debug symbols, so I can't investigate.

@0xcpu 0xcpu closed this as completed Mar 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants