Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anvill to Rellic does not compile #293

Closed
Ninja3047 opened this issue Aug 19, 2022 · 1 comment · Fixed by #294
Closed

Anvill to Rellic does not compile #293

Ninja3047 opened this issue Aug 19, 2022 · 1 comment · Fixed by #294
Labels
bug Something isn't working

Comments

@Ninja3047
Copy link
Contributor

#!/usr/bin/env bash

BIN=$1

python3 -m anvill --bin_in "${BIN}" --spec_out "${BIN}.spec.json" && \
anvill-decompile-json -spec "${BIN}.spec.json" -bc_out "${BIN}.bc" && \
rellic-decomp -input "${BIN}.bc" -output "${BIN}.decomp.c"
#include <stdio.h>

int fizz_buzz(int n) {
        for (int i = 0; i < n; i++) {
                if (i % 3 == 0) {
                        printf("Fizz");
                }
                if (i % 5 == 0) {
                        printf("Buzz");
                }
                if (i % 5 != 0 && i % 3 != 0) {
                        printf("%d", i);
                }
                puts("");
        }
        return 0;
}

int main(int argc, char* argv[]) {
        fizz_buzz(100);
        return 0;
}

used the following script to try and decompile an anvill lifted binary

using the following anvill and rellic versions

anvill-decompile-json version unknown
Commit Hash: d0063e0054472be42ca71bcfa087f2f5746c0bbf
Commit Date: 2022-07-29 08:03:46 -0400

rellic-decomp version unknown
Commit Hash: 9b7913cdfa860fbfcad81aeaf3f88acf37ee85a2
Commit Date: 2022-08-12 11:38:38 -0400

The test file does get a decompiled output C file but does not compile again due to the following error

test-fizzbuzz-elf-x64.decomp.c:363:8: error: redefinition of 'struct0'
struct struct0 {
       ^
test-fizzbuzz-elf-x64.decomp.c:334:8: note: previous definition is here
struct struct0 {
       ^
test-fizzbuzz-elf-x64.decomp.c:378:8: error: redefinition of 'struct0'
struct struct0 {
       ^
test-fizzbuzz-elf-x64.decomp.c:334:8: note: previous definition is here
struct struct0 {
       ^

test-fizzbuzz.tar.gz

@Ninja3047 Ninja3047 added the bug Something isn't working label Aug 19, 2022
@frabert
Copy link
Collaborator

frabert commented Aug 19, 2022

Can reproduce locally, looks like an issue with name generation while creating the structs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants