AlexeySoshin / smali2java

Recreate Java code from Smali
486 stars 84 forks source link

panic: runtime error: slice bounds out of range [:-1] #24

Open Michdo93 opened 2 years ago

Michdo93 commented 2 years ago

I got following error:

panic: runtime error: slice bounds out of range [:-1]

xiaofengjue commented 1 year ago

I also got the same problem,

acmpo6ou commented 10 months ago

Could this be a problem because there are multiple smali folders? I have smali, smali_classes2, smali_classes3, etc. Maybe it's looking only withing the smali dir, and can't find references to stuff from other smali folders?

The command I used is:

../smali2java_darwin_amd64  -path_to_smali=smali

output:

panic: runtime error: slice bounds out of range [:-1]

goroutine 1 [running]:
github.com/alexeysoshin/smali2java/parser.(*MethodParser).Parse(0xc0007279d8, 0xc000727a80, 0xc0002e7c20, 0x5, 0x5, 0x100cb30, 0xf8a4)
    /Users/alexeysoshin/GitHub/smali2java/parser/method.go:84 +0xfb2
github.com/alexeysoshin/smali2java/parser.(*JavaFile).ParseLine(0xc000727a80, 0xc0004bc8a0, 0x5e, 0xc0004bc8a0, 0x5e)
    /Users/alexeysoshin/GitHub/smali2java/parser/java_file.go:117 +0x9f3
main.convertSmali(0xc0004a8720, 0x10, 0xc0000180a0)
    /Users/alexeysoshin/GitHub/smali2java/smali2java.go:70 +0x236
main.parseSmaliFiles.func1(0xc0004a8720, 0x10, 0x1114ea0, 0xc00006a680, 0x0, 0x0, 0x7, 0xc000727c80)
    /Users/alexeysoshin/GitHub/smali2java/smali2java.go:40 +0x185
path/filepath.walk(0xc0004a8720, 0x10, 0x1114ea0, 0xc00006a680, 0xc000727f10, 0x0, 0x0)
    /usr/local/Cellar/go/1.15.3/libexec/src/path/filepath/path.go:360 +0x423
path/filepath.walk(0xc0002f30f0, 0x8, 0x1114ea0, 0xc00006a340, 0xc000727f10, 0x0, 0x0)
    /usr/local/Cellar/go/1.15.3/libexec/src/path/filepath/path.go:384 +0x2fe
path/filepath.walk(0x2055fd37a, 0x5, 0x1114ea0, 0xc00006b040, 0xc000727f10, 0x0, 0x10)
    /usr/local/Cellar/go/1.15.3/libexec/src/path/filepath/path.go:384 +0x2fe
path/filepath.Walk(0x2055fd37a, 0x5, 0xc000070f10, 0x10bb305, 0xc00005e180)
    /usr/local/Cellar/go/1.15.3/libexec/src/path/filepath/path.go:406 +0x105
main.parseSmaliFiles(0x2055fd37a, 0x5)
    /Users/alexeysoshin/GitHub/smali2java/smali2java.go:29 +0x76
main.main()
    /Users/alexeysoshin/GitHub/smali2java/smali2java.go:23 +0xe8
alvaroyecla commented 6 months ago

Same here

zyzhang-aibee commented 4 weeks ago

maybe because use the bin, ./bin/smali2java_darwin_amd64 -path_to_smali=xxxxx got same error, but go run smali2java.go -path_to_smali=xxxxx succeed