Expand description
Database validation for untrusted files
Provides comprehensive validation of .mxy database files including:
- Standard: All offsets, UTF-8 validation, basic structure
- Strict: Deep graph analysis, cycles, redundancy checks Database validation for untrusted .mxy files
This module provides comprehensive validation of MMDB format database files (.mxy) to ensure they are safe to load and use. It performs thorough checks of:
- MMDB metadata and structure
- Embedded PARAGLOB sections (if present)
- All offsets and bounds checking
- UTF-8 validity of all strings
- Graph structure integrity (no cycles, valid transitions)
- Data consistency (arrays, mappings, references)
§Safety
The validator is designed to detect malformed, corrupted, or malicious databases without panicking or causing undefined behavior. All checks use safe Rust with explicit bounds checking.
§Usage
use matchy::validation::{validate_database, ValidationLevel};
use std::path::Path;
let report = validate_database(Path::new("database.mxy"), ValidationLevel::Strict)?;
if report.is_valid() {
println!("✓ Database is safe to use");
} else {
println!("✗ Validation failed:");
for error in &report.errors {
println!(" - {}", error);
}
}Structs§
- Database
Stats - Database statistics gathered during validation
- Validation
Report - Validation report with detailed findings
Enums§
- Validation
Level - Validation strictness level
Functions§
- validate_
database - Validate a database file