avast / avast/retdec

Error: Loading of the config failed: Invalid encoding in string. @ line = 194111, column = 31.

Open
#720 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

Hello. I've just installed retdec, compiled a Go's hello world and tried to decompile it. As result I receive an error:
```
Error: Loading of the config failed: Invalid encoding in string. @ line = 194111, column = 31.
```

```
$ /opt/retdec/bin/retdec-decompiler.py helloworld
##### Checking if file is a Mach-O Universal static library...

##### Checking if file is an archive...
RUN: /opt/retdec/bin/retdec-ar-extractor /tmp/helloworld/helloworld --arch-magic
Not an archive, going to the next step.

##### Gathering file information...
RUN: /opt/retdec/bin/retdec-fileinfo -c /tmp/helloworld/helloworld.config.json --similarity /tmp/helloworld/helloworld --no-hashes=all --crypto /opt/retdec/bin/../share/retdec/support/generic/yara_patterns/signsrch/signsrch.yara --crypto /opt/retdec/bin/../share/retdec/support/generic/yara_patterns/signsrch/signsrch.yarac --max-memory-half-ram
Input file : /tmp/helloworld/helloworld
File format : ELF
File class : 64-bit
File type : Executable file
Architecture : x86-64
Endianness : Little endian
Entry point address : 0x454ad0
Entry point offset : 0x54ad0
Entry point section name : .text
Entry point section index: 1
Bytes on entry point : e92bc6ffffcccccccccccccccccccccc8b7c2408b8e70000000f05c3cccccccc488b442408c70000000000bf00000000b83c
Detected tool : gc (compiler), section table heuristic
Original language : Go
Warning: Unknown note type found.

##### Trying to unpack /tmp/helloworld/helloworld into /tmp/helloworld/helloworld-unpacked.tmp by using generic unpacker...
RUN: /opt/retdec/bin/retdec-unpacker /tmp/helloworld/helloworld -o /tmp/helloworld/helloworld-unpacked.tmp --max-memory-half-ram
No matching plugins found for 'gc'
##### Unpacking by using generic unpacker: nothing to do

##### Trying to unpack /tmp/helloworld/helloworld into /tmp/helloworld/helloworld-unpacked.tmp by using UPX...
RUN: upx -d /tmp/helloworld/helloworld -o /tmp/helloworld/helloworld-unpacked.tmp
upx: /tmp/helloworld/helloworld: NotPackedException: not packed by UPX
##### Unpacking by using UPX: nothing to do

##### Decompiling /tmp/helloworld/helloworld into /tmp/helloworld/helloworld.bc...
RUN: /opt/retdec/bin/retdec-bin2llvmir -provider-init -decoder -verify -x87-fpu -main-detection -idioms-libgcc -inst-opt -cond-branch-opt -syscalls -stack -constants -param-return -local-vars -inst-opt -simple-types -generate-dsm -remove-asm-instrs -class-hierarchy -select-fncs -unreachable-funcs -inst-opt -x86-addr-spaces -register-localization -value-protect -instcombine -tbaa -basicaa -simplifycfg -early-cse -tbaa -basicaa -globalopt -mem2reg -instcombine -simplifycfg -early-cse -lazy-value-info -jump-threading -correlated-propagation -simplifycfg -instcombine -simplifycfg -reassociate -loops -loop-simplify -lcssa -loop-rotate -licm -lcssa -instcombine -loop-simplifycfg -loop-simplify -aa -loop-accesses -loop-load-elim -lcssa -indvars -loop-idiom -loop-deletion -gvn -sccp -instcombine -lazy-value-info -jump-threading -correlated-propagation -dse -bdce -adce -simplifycfg -instcombine -strip-dead-prototypes -globaldce -constmerge -constprop -instcombine -instcombine -tbaa -basicaa -simplifycfg -early-cse -tbaa -basicaa -globalopt -mem2reg -instcombine -simplifycfg -early-cse -lazy-value-info -jump-threading -correlated-propagation -simplifycfg -instcombine -simplifycfg -reassociate -loops -loop-simplify -lcssa -loop-rotate -licm -lcssa -instcombine -loop-simplifycfg -loop-simplify -aa -loop-accesses -loop-load-elim -lcssa -indvars -loop-idiom -loop-deletion -gvn -sccp -instcombine -lazy-value-info -jump-threading -correlated-propagation -dse -bdce -adce -simplifycfg -instcombine -strip-dead-prototypes -globaldce -constmerge -constprop -instcombine -inst-opt -simple-types -stack-ptr-op-remove -idioms -instcombine -inst-opt -idioms -remove-phi -value-protect -sink -config-path /tmp/helloworld/helloworld.config.json -max-memory-half-ram -o /tmp/helloworld/helloworld.bc
Running phase: Initialization ( 0.01s )
Running phase: LLVM ( 0.02s )
Running phase: Providers initialization ( 0.02s )
Running phase: Input binary to LLVM IR decoding ( 0.16s )
Running phase: LLVM ( 1.85s )
Running phase: x87 fpu register analysis ( 2.04s )
Running phase: Main function identification optimization ( 2.10s )
Running phase: Libgcc idioms optimization ( 2.10s )
Running phase: LLVM instruction optimization ( 2.11s )
Running phase: Conditional branch optimization ( 2.21s )
Running phase: Syscalls optimization ( 2.82s )
Running phase: Stack optimization ( 2.82s )
Running phase: Constants optimization ( 4.19s )
unhandled type catched : void () @ 55e248
Running phase: Function parameters and returns optimization ( 7.92s )
Running phase: Register localization optimization ( 9.93s )
Running phase: LLVM instruction optimization ( 10.73s )
Running phase: Simple types recovery optimization ( 10.84s )
Running phase: Disassembly generation ( 12.14s )
Running phase: Assembly mapping instruction removal ( 13.03s )
Running phase: C++ class hierarchy optimization ( 13.76s )
Running phase: Selected functions optimization ( 13.84s )
Running phase: Unreachable functions optimization ( 13.84s )
Running phase: LLVM instruction optimization ( 13.97s )
Running phase: x86 address spaces optimization ( 14.07s )
Running phase: Make all registers local ( 14.13s )
Running phase: Value protection optimization ( 14.26s )
Running phase: LLVM ( 14.39s )
Running phase: LLVM instruction optimization ( 29.94s )
Running phase: Simple types recovery optimization ( 29.97s )
Running phase: Stack pointer operations optimization ( 29.99s )
Running phase: Instruction idioms optimization ( 30.03s )
Running phase: LLVM ( 30.11s )
Running phase: LLVM instruction optimization ( 30.68s )
Running phase: Instruction idioms optimization ( 30.71s )
Running phase: Phi removal ( 30.78s )
Running phase: Value protection optimization ( 30.85s )
Running phase: Code sinking ( 30.87s )
Running phase: LLVM ( 31.08s )
Running phase: Bitcode Writer ( 31.21s )
Running phase: Assembly Writer ( 31.81s )
Running phase: Cleanup ( 32.24s )

##### Decompiling /tmp/helloworld/helloworld.bc into /tmp/helloworld/helloworld.c...
RUN: /opt/retdec/bin/retdec-llvmir2hll -target-hll=c -output-format=plain -var-renamer=readable -var-name-gen=fruit -var-name-gen-prefix= -call-info-obtainer=optim -arithm-expr-evaluator=c -validate-module -o /tmp/helloworld/helloworld.c /tmp/helloworld/helloworld.bc -enable-debug -emit-debug-comments -config-path=/tmp/helloworld/helloworld.config.json -max-memory-half-ram
Running phase: initialization ( 0.37s )
-> creating the used HLL writer [c] ( 0.37s )
-> creating the used alias analysis [simple] ( 0.37s )
-> creating the used call info obtainer [optim] ( 0.37s )
-> creating the used evaluator of arithmetical expressions [c] ( 0.37s )
-> creating the used variable names generator [fruit] ( 0.37s )
-> creating the used variable renamer [readable] ( 0.37s )
-> creating the used semantics [libc,gcc-general,win-api] ( 0.37s )
-> loading the input config ( 0.37s )
Error: Loading of the config failed: Invalid encoding in string. @ line = 194111, column = 31.

##### Done!
```

```
$ cat hello.go
package main
import "fmt"
func main() {
fmt.Println("Hello, world!")
}
$ go build
$ go version
go version go1.13 linux/amd64
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with hello.go and the retdec-decompiler.py command shown. Inspect /tmp/helloworld/helloworld.config.json and the retdec-llvmir2hll config-loading step, where the invalid encoding is reported. Done means the Go hello-world binary completes decompilation without the config encoding error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.