Skip to content

Conversation

ZeroHack01
Copy link

@ZeroHack01 ZeroHack01 commented Jun 21, 2025

🎯 Enhanced Fuzzing Target for Adblock Parser

What Changed

Improved the fuzzing target to provide better code coverage and robustness for finding edge cases in the adblock filter parser.

Key Improvements

  • Multiple FilterFormats: Tests Standard, Hosts, and AdblockPlus (was only Hosts)
  • Input Validation: Added bounds checking to prevent hangs on large inputs
  • Panic Safety: Added catch_unwind protection
  • Better Coverage: Tests common filter prefixes (||, @@, ###, etc.)
  • Proper Error Handling: Processes parse results instead of ignoring them

Before

// Only tested FilterFormat::Hosts, no input validation
fuzz_target!(|data: &[u8]| {
    if let Ok(filter) = std::str::from_utf8(data) {
        parse_filter(filter, true, ParseOptions {
            format: FilterFormat::Hosts,
            ..Default::default()
        }); // Result ignored
    }
});

@ZeroHack01 ZeroHack01 requested a review from antonok-edm as a code owner June 21, 2025 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant