flash-lso

Crates.ioflash-lso
lib.rsflash-lso
version0.5.0
sourcesrc
created_at2020-06-24 16:37:46.079107
updated_at2021-02-08 20:52:48.274648
descriptionFast and safe SOL/AMF0/AMF3 parsing. Supports serde, Adobe flex and cyclic references
homepage
repositoryhttps://github.com/CUB3D/rust-sol
max_upload_size
id257621
size12,288,612
Callum Thomson (CUB3D)

documentation

README

flash-lso

GitHub license GitHub issues

A parser and serializer for Adobe Local Shared Object (LSO) file format (.sol), AMF0 and AFM3 in 100% safe rust

The primary goal of this crate is to be as safe as possible against malformed and invalid input and to fail cleanly when this is identified.

Example

use std::fs::File;
use std::io::Read;
use flash_lso::read::Reader;
fn main() {
    let mut x = File::open(path).expect("Couldn't open file");
    let mut data = Vec::new();
    let _ = x.read_to_end(&mut data).expect("Unable to read file");
    let d = Reader::default().parse_full(&data).expect("Failed to parse lso file");
    println!("{:#?}", d);
}

Web

The web directory contains an example web viewer for LSO files using yew. To run, first build into WASM like so

cd web
wasm-pack build --out-name wasm --out-dir ./static --target web --release

Then serve the static directory like so

# If needed install miniserve with `cargo install miniserve`
miniserve ./static --index index.html

Development / Testing

This project has a collection of integration tests to verify that it is able to serialize and then deserialize LSO files to produce output that is identical to it's input Also available is a lso-to-json project which allows dumping an LSO file to json for debugging and testing.

Features

To enable serde support

flash-lso = { version = "0.2.0", features = ["serde"] }

To enable (alpha) support for flex

flash-lso = { version = "0.2.0", features = ["flex"] }

Fuzzing

This project makes use of cargo-fuzz to ensure correct handling of invalid data

cargo fuzz run --release fuzz_amf3_body

License

This project is licensed under MIT

Commit count: 188

cargo fmt