mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-20 12:18:18 +00:00
Error on invalid b instruction (#6109)
If label resolves to an offset of 0, assume instruction invalid
This commit is contained in:
parent
7bf7ff3fad
commit
80da50f31f
@ -421,6 +421,10 @@ static int thumb_assemble(ArmOpcode *ao, ut64 off, const char *str) {
|
|||||||
} else
|
} else
|
||||||
if (!strcmpnull (ao->op, "b") || !strcmpnull (ao->op, "b.n")) {
|
if (!strcmpnull (ao->op, "b") || !strcmpnull (ao->op, "b.n")) {
|
||||||
//uncond branch : PC += 4 + (delta*2)
|
//uncond branch : PC += 4 + (delta*2)
|
||||||
|
int offset = getnum (ao->a[0]);
|
||||||
|
if (offset == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
int delta = getnum (ao->a[0]) - 4 - ao->off;
|
int delta = getnum (ao->a[0]) - 4 - ao->off;
|
||||||
if ((delta < -2048) || (delta > 2046) || (delta & 1)) {
|
if ((delta < -2048) || (delta > 2046) || (delta & 1)) {
|
||||||
eprintf("branch out of range or not even\n");
|
eprintf("branch out of range or not even\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user