Instructions such as ret are being treated as if they flow into the next instruction.
Instruction::Instruction automatically sets FLAG_FLOW if next_instruction is valid. In the IDA exporter, next_instruction is chosen by looking for xrefs from the current instruction, so diverging instructions would have next_instruction == 0, which is invalid, causing FLAG_FLOW to not be set. But in the Binary Ninja exporter, we just have:
// TODO(cblichmann): Is this always the case in Binja?
const Address next_instruction = address + instruction.length;
So it always gets set.
The code does already check for regular control flow later on, so it might be easiest to just reset FLAG_FLOW at that point:
Instructions such as
ret
are being treated as if they flow into the next instruction.Instruction::Instruction
automatically setsFLAG_FLOW
ifnext_instruction
is valid. In the IDA exporter,next_instruction
is chosen by looking for xrefs from the current instruction, so diverging instructions would havenext_instruction == 0
, which is invalid, causingFLAG_FLOW
to not be set. But in the Binary Ninja exporter, we just have:So it always gets set.
The code does already check for regular control flow later on, so it might be easiest to just reset
FLAG_FLOW
at that point: