mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-26 08:18:18 +00:00
refactor: expose test fuzz owner symbols (#3752)
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
#![no_main]
|
||||
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
use rustfs_ecstore::api::bucket as ecstore_bucket;
|
||||
use rustfs_ecstore::api::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);
|
||||
@@ -22,10 +24,10 @@ fn looks_like_ipv4(text: &str) -> bool {
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
let (bucket, object) = parse_case(data);
|
||||
|
||||
let strict_bucket_ok = ecstore_bucket::utils::check_valid_bucket_name_strict(&bucket).is_ok();
|
||||
let valid_bucket_for_object_ops = strict_bucket_ok || ecstore_bucket::utils::is_meta_bucketname(&bucket);
|
||||
let pair_ok = ecstore_bucket::utils::check_bucket_and_object_names(&bucket, &object).is_ok();
|
||||
let list_ok = ecstore_bucket::utils::check_list_objs_args(&bucket, &object, &None).is_ok();
|
||||
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();
|
||||
|
||||
if strict_bucket_ok {
|
||||
let trimmed = bucket.trim();
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#![no_main]
|
||||
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
use rustfs_ecstore::api::bucket as ecstore_bucket;
|
||||
use rustfs_ecstore::api::bucket::utils::{
|
||||
check_object_name_for_length_and_slash, has_bad_path_component, is_valid_object_prefix,
|
||||
};
|
||||
use rustfs_utils::path::{clean, path_join};
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
@@ -92,9 +94,9 @@ fuzz_target!(|data: &[u8]| {
|
||||
let (bucket, base_object, extra, flags) = parse_case(data);
|
||||
let object = materialize_object(base_object, &extra, &flags);
|
||||
|
||||
let has_bad_component = ecstore_bucket::utils::has_bad_path_component(&object);
|
||||
let is_valid_prefix = ecstore_bucket::utils::is_valid_object_prefix(&object);
|
||||
let length_and_slash_ok = ecstore_bucket::utils::check_object_name_for_length_and_slash(&bucket, &object).is_ok();
|
||||
let has_bad_component = has_bad_path_component(&object);
|
||||
let is_valid_prefix = is_valid_object_prefix(&object);
|
||||
let length_and_slash_ok = check_object_name_for_length_and_slash(&bucket, &object).is_ok();
|
||||
|
||||
if object.is_empty() || !(is_valid_prefix && length_and_slash_ok) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user