2

I am trying to modify cfunc AST from

If (a1 && some_func_ptr) {
  some_func_ptr();
}

To

if (a1) {
  some_func_ptr();
}

But I constantly get INTERR 50683 error. I tried

new_item = idaapi.cexpr_t(item.cif.expr.x)
item.cif.expr.swap(new_item)

Also many other attempts to modify other parts of AST fail in the same way. I suspect that it has something to do with thisown flag, but various changes did nothing.

2
  • Have you tried getting in touch with the Hex-Rays support? While I'd love to see the answer to your question also here in our Q&A, contacting the support is oftentimes faster and leads to better results for very specific questions like this.
    – 0xC0000022L
    Aug 3 at 8:01
  • Due to political reasons Hex-Rays support stopped answering.
    – mizari
    Aug 4 at 1:41

1 Answer 1

1

The 50683 INTERR means address is invalid. There is a check applied by verifier (\IDAFolder\plugins\hexrays_sdk\verifier\cverify.cpp) in cfunc_t::verify_insn function:

case cit_if:
  if ( maturity < CMAT_TRANS1 || maturity >= CMAT_CASTED )
  {
    ea_t jea = i->cif->expr.calc_jmp_cnd_ea();
    if ( jea != BADADDR && i->ea != jea )
      // ctree: mismatch in if-statement and its expression addresses
      CFAIL_QASSERT(50683, i);
  }

There are also many other INTERRs for decompilation in case anyone is looking. So, the correct code in my case had to have something like this:

new_item = idaapi.cexpr_t(item.cif.expr.x)
new_item.ea = item.cif.expr.ea
# or just new_item.ea = idaapi.BADADDR it works too
item.cif.expr.swap(new_item)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.