beardypig/ghidra-emotionengine

Incorrect usage of & instead of &&?

Opened this issue · 4 comments

if ((refType.isJump() || refType.isCall()) & refType.isComputed()) {

Is this an accidental usage of & instead of &&?

if ((refType.isJump() || refType.isCall()) & refType.isComputed()) {

Is this an accidental usage of & instead of &&?

This is a good question. The analyzer is a copy of the MipsAddressAnalyzer in Ghidra with the necessary changes for this plugin.

@emteere if you have a moment may you confirm whether this is correct or not? This is the same as line 388 in MipsAddressAnalyzer.java

I haven't looked at the return types, but if they are all Boolean then it won't make a difference will it?

I haven't looked at the return types, but if they are all Boolean then it won't make a difference will it?

I was thinking about that. It wouldn't matter in c. I'm assuming it wouldn't either in java.

Technically it should work since "true" is 1 and "false" is 0, so ("true" & "true") == "true". I was just pointing out the bug.