Add fuzzing infrastructure with cargo-fuzz #34
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #25
Changes
Added comprehensive fuzzing infrastructure using cargo-fuzz and libFuzzer.
Fuzz Targets
Created 4 fuzz targets to test critical functionality:
fuzz_new_from_strings.rs
CStringArray::new(Vec<String>)constructorfuzz_from_cstrings.rs
from_cstrings(Vec<CString>)constructorfuzz_pointer_operations.rs
as_ptr()returns valid char** pointerget()bounds checking and element accessfuzz_try_from.rs
TryFrom<Vec<&str>>- string slice conversionTryFrom<Vec<String>>- owned string conversionTryFrom<Vec<CString>>- CString conversionCI Integration
Created .github/workflows/fuzz.yml:
REUSE Compliance
Updated REUSE.toml:
.github/workflows/*.ymlto CC0-1.0 annotationfuzz/Cargo.tomlto CC0-1.0 annotationfuzz/fuzz_targets/*.rswith MIT license annotationBenefits
Testing
All fuzz targets tested locally with cargo-fuzz:
All targets completed successfully with no crashes:
Security Impact
This fuzzing infrastructure significantly improves the security posture: