mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-25 21:46:50 +00:00
refactor: narrow test harness compatibility surfaces (#3592)
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
#![no_main]
|
||||
|
||||
#[path = "bucket_validation/storage_compat.rs"]
|
||||
mod storage_compat;
|
||||
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
use crate::storage_compat::ecstore::bucket::utils::{check_bucket_and_object_names, check_list_objs_args, check_valid_bucket_name_strict};
|
||||
use crate::storage_compat::ecstore::bucket::utils::{
|
||||
check_bucket_and_object_names, check_list_objs_args, check_valid_bucket_name_strict, is_meta_bucketname,
|
||||
};
|
||||
|
||||
fn parse_case(data: &[u8]) -> (String, String) {
|
||||
let text = String::from_utf8_lossy(data);
|
||||
@@ -25,6 +28,7 @@ fuzz_target!(|data: &[u8]| {
|
||||
let (bucket, object) = parse_case(data);
|
||||
|
||||
let strict_bucket_ok = check_valid_bucket_name_strict(&bucket).is_ok();
|
||||
let valid_bucket_for_object_ops = strict_bucket_ok || is_meta_bucketname(&bucket);
|
||||
let pair_ok = check_bucket_and_object_names(&bucket, &object).is_ok();
|
||||
let list_ok = check_list_objs_args(&bucket, &object, &None).is_ok();
|
||||
|
||||
@@ -48,10 +52,16 @@ fuzz_target!(|data: &[u8]| {
|
||||
}
|
||||
|
||||
if pair_ok {
|
||||
assert!(strict_bucket_ok, "accepted bucket/object pair must also satisfy strict bucket validation");
|
||||
assert!(
|
||||
valid_bucket_for_object_ops,
|
||||
"accepted bucket/object pair must satisfy strict bucket validation or meta bucket compatibility"
|
||||
);
|
||||
}
|
||||
|
||||
if list_ok {
|
||||
assert!(strict_bucket_ok, "accepted list-object args must also satisfy strict bucket validation");
|
||||
assert!(
|
||||
valid_bucket_for_object_ops,
|
||||
"accepted list-object args must satisfy strict bucket validation or meta bucket compatibility"
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user