(vm: &mut Vm, debug: DebugConfig)
| 456 | } |
| 457 | |
| 458 | fn debug_lowpan(vm: &mut Vm, debug: DebugConfig) { |
| 459 | if debug.output.is_some() { |
| 460 | const USART_SERIAL_PUTCHAR: u64 = 0x2a1c; |
| 461 | register_char_out_printer(vm, USART_SERIAL_PUTCHAR, "r1"); |
| 462 | } |
| 463 | |
| 464 | let reg_r0 = vm.cpu.arch.sleigh.get_varnode("r0").unwrap(); |
| 465 | |
| 466 | // Fragment offset is not bounds-checked in `sicslowpan::input` |
| 467 | let out = debug.clone(); |
| 468 | vm.hook_address(0x4806, move |cpu, _addr| { |
| 469 | let r0 = cpu.read_reg(reg_r0); |
| 470 | // uncomp_hdr_len + (uint16_t)(frag_offset << 3) > UIP_BUFSIZE |
| 471 | if r0 >= 400 { |
| 472 | out.error( |
| 473 | cpu, |
| 474 | &format!("uncomp_hdr_len + (frag_offset << 3) > UIP_BUFSIZE (size = {r0})"), |
| 475 | bug(LOWPAN_SENDER, 2), |
| 476 | ); |
| 477 | } |
| 478 | }); |
| 479 | } |
| 480 | |
| 481 | fn debug_utasker_modbus(vm: &mut Vm, debug: DebugConfig) { |
| 482 | if debug.output.is_some() { |
no test coverage detected