avast / avast/retdec-idaplugin

Statically linked code is not removed when decompiling through the IDA plugin

Open
#10 0 comments 0 reactions 1 assignee Claimed by @PeterMatula View on GitHub
bug P-output
Dominant language
C++
Stars
799
Forks
132
PR merge metrics
No merged PRs in 30d

Description

When the attached PE binary file is decompiled through the IDA plugin, statically linked code is not removed, but when I decompile it directly through `decompile.sh`, it is removed.

## Input and output files

The input and both output C files can be downloaded [here](https://github.com/avast-tl/retdec-idaplugin/files/1629147/input-and-outputs.zip).

## Steps to reproduce

1. Decompile the input binary file `hello-world.exe` through the IDA plugin via [`run-ida-decompilation.sh`](https://github.com/avast-tl/retdec-idaplugin/blob/master/scripts/run-ida-decompilation.sh):
```sh
$ run-ida-decompilation.sh hello-world.exe -o hello-world.idpalugin.c
```
2. Decompile the same file directly through `decompile.sh`:
```sh
$ decompile.sh hello-world.exe -o hello-world.decompile-sh.c
```

## Expected output

The input binary file `hello-world.exe` contains just `main()` with `printf("Hello, world!");`. This is exactly what `decompile.sh` produces in `hello-world.decompile-sh.c` (just a single `main()` function and nothing more).

However, `hello-world.idaplugin.c` contains not only `_main()` but also 47 other functions that come from statically linked code. I would expect them to be removed, just like when the file is decompiled directly through `decompile.sh`.

## Configuration

* `retdec` commit: [`8c4b23d`](https://github.com/avast-tl/retdec/commit/8c4b23dbbf0f2baaf6f2309fc189b054f58250ea) (current `master`)
* `retdec-idaplugin` commit: e249927a86c4ebd3b8d5c19de72cdf9f364bef3d (current `master`)
* 64b Arch Linux, GCC 7.2.1, Debug builds of both RetDec and IDA plugin

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.