21 releases (11 breaking)
0.14.0 | May 8, 2022 |
---|---|
0.13.0 | Jul 23, 2021 |
0.12.0 | Sep 5, 2020 |
0.11.0 | Feb 5, 2020 |
0.0.1 | Jul 31, 2017 |
#1083 in Parser implementations
Used in swf-emitter
185KB
4.5K
SLoC
SWF Parser (Rust)
SWF parser implemented in Rust.
Converts bytes to swf-types
movies.
Usage
use swf_parser::parse_swf;
use swf_types::Movie;
fn main() {
let swf_bytes: Vec<u8> = ::std::fs::read("movie.swf").expect("Failed to read movie");
let movie: Movie = parse_swf(&swf_bytes).expect("Failed to parse SWF");
}
Features
SWF decompression is provided by the following features, enabled by default:
deflate
: enable support forCompressionMethod::Deflate
, using theinflate
crate.lzma
: enable support forCompressionMethod::Lzma
, using thelzma-rs
crate.
Disabling these features will cause the SWF parsing functions to fail when passed the corresponding CompressionMethod
.
Contributing
This repo uses Git submodules for its test samples:
# Clone with submodules
git clone --recurse-submodules git://github.com/open-flash/swf-parser.git
# Update submodules for an already-cloned repo
git submodule update --init --recursive --remote
This library is a standard Cargo project. You can test your changes with
cargo test
. The commands must be run from the rs
directory.
Fuzzing
The Rust implementation supports fuzzing:
# Make sure that you have `cargo-fuzz`
cargo install cargo-fuzz
# Fuzz the `swf` parser
cargo fuzz run swf
Prefer non-master
branches when sending a PR so your changes can be rebased if
needed. All the commits must be made on top of master
(fast-forward merge).
CI must pass for changes to be accepted.
Dependencies
~1.2–1.8MB
~35K SLoC