Skip to content

Commit

Permalink
Move the non-null check for ctx inside the valid branch
Browse files Browse the repository at this point in the history
    * When we pop the FPU stack we pass in a `NULL` context since no
      resizing would be needed, which causes a failure if the non-null
      check for the `ctx` is outside the branch
    * Fixes failing tests in `db/asm`
  • Loading branch information
DMaroo committed Jan 11, 2024
1 parent cb9c78e commit 89ab0fa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion librz/analysis/arch/x86/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1333,11 +1333,12 @@ RZ_IPI RzILOpFloat *x86_il_fsqrt_with_rmode_ctx(RZ_OWN RZ_NONNULL RzILOpFloat *x
* \return RzILOpFloat*
*/
RZ_IPI RzILOpEffect *x86_il_set_st_reg_ctx(X86Reg reg, RZ_OWN RZ_NONNULL RzILOpFloat *val, RzFloatFormat val_format, RZ_BORROW RZ_NONNULL X86ILContext *ctx) {
rz_return_val_if_fail(val && ctx && x86_il_is_st_reg(reg), NULL);
rz_return_val_if_fail(val && x86_il_is_st_reg(reg), NULL);

if (val_format == RZ_FLOAT_IEEE754_BIN_80) {
return SETG(x86_registers[reg], F2BV(val));
} else {
rz_return_val_if_fail(ctx, NULL);
RzILOpFloat *converted_val = x86_il_resize_floating(val, val_format);

return SETG(x86_registers[reg], F2BV(converted_val));
Expand Down

0 comments on commit 89ab0fa

Please sign in to comment.