(
map: &std::collections::HashMap<String, String>,
field_name: &str,
)
| 260 | const MAX_ENV_SERIALIZED_SIZE: usize = 256 * 1024; // 256 KiB |
| 261 | |
| 262 | fn validate_env_entries( |
| 263 | map: &std::collections::HashMap<String, String>, |
| 264 | field_name: &str, |
| 265 | ) -> Result<(), Status> { |
| 266 | let total_size: usize = map.iter().map(|(k, v)| k.len() + v.len()).sum(); |
| 267 | if total_size > MAX_ENV_SERIALIZED_SIZE { |
| 268 | return Err(Status::invalid_argument(format!( |
| 269 | "{field_name} total size exceeds {MAX_ENV_SERIALIZED_SIZE} byte limit ({total_size} bytes)" |
| 270 | ))); |
| 271 | } |
| 272 | validate_env_entries_inner(map, field_name, &[]) |
| 273 | } |
| 274 | |
| 275 | fn validate_exec_env_entries( |
| 276 | map: &std::collections::HashMap<String, String>, |
no test coverage detected