image-rs / image-png

PNG decoding and encoding library in pure Rust
https://docs.rs/png
Apache License 2.0
357 stars 140 forks source link

afl binary cannot be built #406

Closed yongmandooo closed 1 year ago

yongmandooo commented 1 year ago

after "cargo afl build", there is an error.

Compiling png-afl v0.2.0 (/home/kym000131/fuzzing_set/Rust/image-png/png-afl) error: declaration of ano_mangle` function --> src/main.rs:11:1 11 #[no_mangle] ^^^^^^^^^^^^

= note: the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them note: the lint level is defined here --> src/main.rs:2:11 | 2 | #![forbid(unsafe_code)] | ^^^^^^^^^^^

error[E0308]: mismatched types --> src/main.rs:19:9 19 let (info, mut reader) = decoder.read_info().map_err( _ ())?; ^^^^^^^^^^^^^^^^^^ ------------------------------------ this expression has type Reader<&[u8]>
expected Reader<&[u8]>, found (_, _)

= note: expected struct Reader<&[u8]> found tuple `(, )``

I think there is a problem in png-afl/src/main.rs

whtsht commented 1 year ago

Since detect_odr_violations=0 is now set by default, you can delete the code that causes the first error.

The second mismatched types error easy to fix.