File tree Expand file tree Collapse file tree 5 files changed +65
-5
lines changed Expand file tree Collapse file tree 5 files changed +65
-5
lines changed Original file line number Diff line number Diff line change 6161 runs-on : ubuntu-latest
6262 steps :
6363 - uses : actions/checkout@v4
64- - uses : EmbarkStudios/cargo-deny-action@v1
64+ - uses : EmbarkStudios/cargo-deny-action@v2
Original file line number Diff line number Diff line change @@ -12,12 +12,10 @@ default = ["pcx"]
1212pcx = [" dep:pcx" ]
1313
1414[dependencies ]
15- image = { version = " 0.25.5 " , default-features = false }
15+ image = { version = " 0.25.8 " , default-features = false }
1616pcx = { version = " 0.2.4" , optional = true }
1717
1818[dev-dependencies ]
19- image = { version = " 0.25.5 " , default-features = false , features = [" png" ] }
19+ image = { version = " 0.25.8 " , default-features = false , features = [" png" ] }
2020walkdir = " 2.5.0"
2121
22- [patch .crates-io ]
23- image = { git = " https://github.com/fintelia/image" , branch = " decoding-hooks" }
Original file line number Diff line number Diff line change 1+
2+ [package ]
3+ name = " image-fuzz"
4+ version = " 0.0.1"
5+ authors = [" Automatically generated" ]
6+ edition = " 2021"
7+ publish = false
8+
9+ [package .metadata ]
10+ cargo-fuzz = true
11+
12+ [dependencies ]
13+ image = { version = " 0.25.8" , default-features = false }
14+
15+ [dependencies .image-extras ]
16+ path = " .."
17+ features = []
18+ [dependencies .libfuzzer-sys ]
19+ version = " 0.4"
20+
21+ # Prevent this from interfering with workspaces
22+ [workspace ]
23+ members = [" ." ]
24+
25+ [[bin ]]
26+ name = " fuzzer_script_pcx"
27+ path = " fuzzers/fuzzer_script_pcx.rs"
Original file line number Diff line number Diff line change 1+ # Fuzzing with libfuzzer
2+
3+ For the possibly more up-to-date guide see < https://fuzz.rs/book/cargo-fuzz/setup.html > .
4+
5+ > $ cargo install cargo-fuzz
6+ > $ cargo +nightly fuzz run fuzzer_script_ <format >
7+
8+ # Bug reports
9+
10+ As explained in the project [ README] ( ../README.md ) , fuzzing is not a priority for
11+ this crate and decoders may panic or worse on malformed input. Please do not
12+ open issues for crashes found by fuzzing, unless they are memory safety violations,
13+ though PRs fixing them are welcome.
Original file line number Diff line number Diff line change 1+ #![ no_main]
2+ #[ macro_use]
3+ extern crate libfuzzer_sys;
4+
5+ use image:: ImageDecoder ;
6+ use std:: io:: Cursor ;
7+
8+ fuzz_target ! ( |data: & [ u8 ] | {
9+ let reader = Cursor :: new( data) ;
10+ let Ok ( mut decoder) = image_extras:: pcx:: PCXDecoder :: new( reader) else {
11+ return ;
12+ } ;
13+ let mut limits = image:: Limits :: default ( ) ;
14+ limits. max_alloc = Some ( 1024 * 1024 ) ; // 1 MiB
15+ if limits. reserve( decoder. total_bytes( ) ) . is_err( ) {
16+ return ;
17+ }
18+ if decoder. set_limits( limits) . is_err( ) {
19+ return ;
20+ }
21+ let _ = std:: hint:: black_box( image:: DynamicImage :: from_decoder( decoder) ) ;
22+ } ) ;
You can’t perform that action at this time.
0 commit comments