afl: add main file
for testing that crashes have been resolved previously, binary of the main crate was used, but targets may have more validation than simply checking for panics
This commit is contained in:
		
					parent
					
						
							
								3e56903885
							
						
					
				
			
			
				commit
				
					
						8f70f596b9
					
				
			
		
					 3 changed files with 24 additions and 3 deletions
				
			
		
							
								
								
									
										17
									
								
								tests/afl/src/main.rs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								tests/afl/src/main.rs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
use std::io::Read;
 | 
			
		||||
 | 
			
		||||
fn main() {
 | 
			
		||||
    let mut args = std::env::args();
 | 
			
		||||
    let _program = args.next();
 | 
			
		||||
    let target = args.next().expect("no target");
 | 
			
		||||
    assert_eq!(args.next(), None);
 | 
			
		||||
 | 
			
		||||
    let f = match target.as_str() {
 | 
			
		||||
        "parse" => jotdown_afl::parse,
 | 
			
		||||
        _ => panic!("unknown target '{}'", target),
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    let mut input = Vec::new();
 | 
			
		||||
    std::io::stdin().read_to_end(&mut input).unwrap();
 | 
			
		||||
    f(&input);
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue