()
| 341 | } |
| 342 | |
| 343 | fn generate_performance_attack_inputs() -> Vec<Vec<u8>> { |
| 344 | let mut inputs = Vec::new(); |
| 345 | |
| 346 | // Deeply nested structures |
| 347 | let mut nested = vec![b'Q']; |
| 348 | let nested_query = "SELECT ".to_string() + &"(".repeat(1000) + &")".repeat(1000); |
| 349 | nested.extend_from_slice(&((nested_query.len() + 5) as u32).to_be_bytes()); |
| 350 | nested.extend_from_slice(nested_query.as_bytes()); |
| 351 | nested.push(0); |
| 352 | inputs.push(nested); |
| 353 | |
| 354 | // Very long identifiers |
| 355 | let mut long_id = vec![b'Q']; |
| 356 | let long_name = "a".repeat(10000); |
| 357 | long_id.extend_from_slice(&((long_name.len() + 5) as u32).to_be_bytes()); |
| 358 | long_id.extend_from_slice(long_name.as_bytes()); |
| 359 | long_id.push(0); |
| 360 | inputs.push(long_id); |
| 361 | |
| 362 | // Many parameters |
| 363 | let mut many_params = vec![b'P']; |
| 364 | let query = "SELECT ".to_string() + &"$1,".repeat(1000); |
| 365 | many_params.extend_from_slice(&((query.len() + 1000) as u32).to_be_bytes()); |
| 366 | many_params.extend_from_slice(b"stmt\0"); |
| 367 | many_params.extend_from_slice(query.as_bytes()); |
| 368 | many_params.push(0); |
| 369 | many_params.extend_from_slice(&(1000u16).to_be_bytes()); // 1000 parameter types |
| 370 | many_params.extend(vec![0; 1000 * 4]); // Parameter type OIDs (all zeros for simplicity) |
| 371 | inputs.push(many_params); |
| 372 | |
| 373 | inputs |
| 374 | } |
no test coverage detected