avast / avast/retdec

Wrong calculation of 16bit register update in 64bit context

Open
#820 0 comments 0 reactions 0 assignees View on GitHub
C-bin2llvmir enhancement P-output
Dominant language
C++
Stars
8.6k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

Subject: https://github.com/rfalke/decompiler-subjects/blob/master/from_holdec/x64_zeroing/x64_elf/subject.exe

Actual output:
```
int main(int argc, char ** argv) {
// 0x401040
printf("mov eax: 0x%016lx\n", 0x7654);
printf("mov ax: 0x%016lx\n", 0x55667654);
return 0;
}
```

Expected:
```
int main(int argc, char ** argv) {
// 0x401040
printf("mov eax: 0x%016lx\n", 0x7654);
printf("mov ax: 0x%016lx\n", 0x1122334455667654);
return 0;
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the x64_zeroing/x64_elf/subject.exe sample linked in the issue and reproduce the generated output. Trace the decompiler path handling an AX update in a 64-bit context, comparing the actual and expected values shown here. Done means the generated output preserves the expected upper bits after the 16-bit register update.

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.