avast / avast/retdec

Wrong evaluation of i386 instructions

Open
#844 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
8.6k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

Background: http://kronotai.com/wordpress/339/testing-decompiler-semantics/
Subject: https://github.com/rfalke/decompiler-subjects/tree/master/from_holdec/stress_int_ia32/ia32_elf_base_inst__1_var__no_complex

The test functions for the following instructions do not return the expected zero:
- `cmpxchg`: inst_94_values_var_0()
- `rol`: inst_159_values_var_0(), inst_164_values_var_0(), inst_169_values_var_0(), inst_174_values_var_0()
- `ror`: inst_165_values_var_0(), inst_175_values_var_0()
- `sar`: inst_166_values_var_0()
- `rcr`: inst_210_values_var_0()

Also the carry flag is incorrectly calculated for `sbb`: inst_221_flags_var_0(), inst_224_flags_var_0(),inst_227_flags_var_0(),inst_228_flags_var_0(),inst_229_flags_var_0()

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked decompiler-subjects test case and the named functions: inst_94_values_var_0(), inst_159_values_var_0() through inst_175_values_var_0(), inst_210_values_var_0(), and the listed sbb flag tests. Run those tests to reproduce the incorrect instruction results and carry flags. Done means the affected functions return zero and sbb carry flags match the expected values.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers, reverse-engineering
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.