@@ -6,6 +6,7 @@ use std::fs::File;
6
6
use std:: io;
7
7
use std:: io:: Read ;
8
8
9
+ use unicornafl:: unicorn_const:: Mode ;
9
10
use unicornafl:: unicorn_const:: { uc_error, Arch , Permission } ;
10
11
use unicornafl:: utils:: * ;
11
12
use unicornafl:: RegisterARM ;
@@ -57,7 +58,7 @@ fn main() {
57
58
58
59
let aligned_size = align ( modem_len) ;
59
60
60
- let mut unicorn = init_emu_with_heap ( Arch :: ARM , 1048576 * 20 , 0x90000000 , false )
61
+ let mut unicorn = init_emu_with_heap ( Arch :: ARM , Mode :: THUMB , 1048576 * 20 , 0x90000000 , false )
61
62
. expect ( "failed to create emulator instance" ) ;
62
63
let mut emu = unicorn. borrow ( ) ;
63
64
@@ -553,7 +554,7 @@ fn main() {
553
554
hook ! ( 0x001e6a30 , init) ;
554
555
hook ! ( 0x00489dfc , mcd_unpack) ;
555
556
556
- let place_input_callback = |mut uc : Unicorn , afl_input : & mut [ u8 ] , _: i32 | {
557
+ let place_input_callback = |mut uc : & mut Unicorn , afl_input : & mut [ u8 ] , _: i32 | {
557
558
uc. mem_write ( 0x0A000000 , & ( afl_input. len ( ) as u32 ) . to_le_bytes ( ) )
558
559
. expect ( "failed to write input_size" ) ;
559
560
uc. mem_write ( 0x0A000000 + 8 , & afl_input)
@@ -562,11 +563,9 @@ fn main() {
562
563
} ;
563
564
564
565
let crash_validation_callback =
565
- |_uc : Unicorn , result : uc_error , _input : & [ u8 ] , _: i32 | result != uc_error:: OK ;
566
+ |_uc : & mut Unicorn , result : uc_error , _input : & [ u8 ] , _: i32 | result != uc_error:: OK ;
566
567
567
- // fuzz decoder for ATTACH ACCEPT messages
568
- emu. emu_start ( 0x001e6a31 , 0x001e6c82 , 0 , 1 )
569
- . expect ( "failed to kick off" ) ; // start at offset 1 to run in thumb mode
568
+ set_pc ( & mut emu, 0x001e6a31 ) . unwrap ( ) ;
570
569
let ret = emu. afl_fuzz (
571
570
input_file,
572
571
place_input_callback,
0 commit comments