forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits

styles.rs26 lines, 1.1 KiBHistoryRawDownload
1#![no_main]
2
3use libfuzzer_sys::fuzz_target;
4
5// The `[V4+ Styles]` and `[V4 Styles]` tables with the input as the row set. The first byte picks
6// the table flavour, so the SSA alignment codes and the V4+ ones both get the same rows. A
7// `Format:` line is omitted on odd selectors to reach the built-in column order too.
8fuzz_target!(|data: &[u8]| {
9 let Some((&select, rows)) = data.split_first() else {
10 return;
11 };
12 let section = if select & 1 == 0 { "[V4+ Styles]" } else { "[V4 Styles]" };
13 let format = if select & 2 == 0 {
14 "Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding\n"
15 } else {
16 ""
17 };
18 let mut doc = format!("{section}\n{format}").into_bytes();
19 doc.extend_from_slice(b"Style: ");
20 doc.extend_from_slice(rows);
21 if let Ok(track) = ec_ass::parse(&doc) {
22 for style in &track.styles {
23 let _ = track.style(&style.name);
24 }
25 }
26});