Fix #12417/#12418 (arm assembler heap overflows)

This commit is contained in:
David CARLIER 2018-12-10 15:42:02 +00:00 committed by radare
parent db18c78456
commit e5c14c167b
2 changed files with 2 additions and 2 deletions

View File

@ -6545,7 +6545,7 @@ ut32 armass_assemble(const char *str, ut64 off, int thumb) {
int i, j;
char buf[128];
ArmOpcode aop = {.off = off};
for (i = j = 0; i < sizeof (buf) - 1 && str[i]; i++, j++) {
for (i = j = 0; i < sizeof (buf) - 1 && str[j]; i++, j++) {
if (str[j] == '#') {
i--; continue;
}

View File

@ -756,7 +756,7 @@ static bool parseOperands(char* str, ArmOp *op) {
} else if (!strncmp (token, "asr", 3)) {
op->operands[operand].shift = ARM_ASR;
}
if (op->operands[operand].shift != ARM_NO_SHIFT) {
if (strlen (token) > 4 && op->operands[operand].shift != ARM_NO_SHIFT) {
op->operands_count ++;
op->operands[operand].shift_amount = r_num_math (NULL, token + 4);
if (op->operands[operand].shift_amount > 63) {