AlexeySoshin / smali2java

Recreate Java code from Smali
497 stars 85 forks source link

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

Closed Vftdan closed 3 years ago

Vftdan commented 4 years ago
$ smali2java -path_to_smali=smali/
panic: runtime error: slice bounds out of range [:-1]

goroutine 1 [running]:
github.com/alexeysoshin/smali2java/parser.(*MethodParser).Parse(0xc000063548, 0xc000063630, 0xc0003e8000, 0x5, 0x5, 0xc0003e406c, 0x42)
    /home/vftdan/git/smali2java/parser/method.go:78 +0xdf8
github.com/alexeysoshin/smali2java/parser.(*JavaFile).ParseLine(0xc000063630, 0xc0003b06e0, 0x42, 0xf94, 0xc0003b06e0)
    /home/vftdan/git/smali2java/parser/java_file.go:118 +0x987
main.convertSmali(0xc0003e2320, 0x1b, 0xc000018100)
    /home/vftdan/git/smali2java/smali2java.go:68 +0x21d
main.parseSmaliFiles.func1(0xc0003e2320, 0x1b, 0x515800, 0xc0003e1ba0, 0x0, 0x0, 0x4993e9, 0xc0003e1ba0)
    /home/vftdan/git/smali2java/smali2java.go:40 +0x18b
path/filepath.walk(0xc0003e2320, 0x1b, 0x515800, 0xc0003e1ba0, 0xc000063ee8, 0x0, 0x0)
    /usr/lib/go-1.13/src/path/filepath/path.go:358 +0x425
path/filepath.walk(0xc0003bf5e0, 0x12, 0x515800, 0xc0003e1930, 0xc000063ee8, 0x0, 0x0)
    /usr/lib/go-1.13/src/path/filepath/path.go:382 +0x2ff
path/filepath.walk(0xc000381f80, 0x10, 0x515800, 0xc0003e1860, 0xc000063ee8, 0x0, 0x0)
    /usr/lib/go-1.13/src/path/filepath/path.go:382 +0x2ff
path/filepath.walk(0xc000380100, 0xd, 0x515800, 0xc0003e09c0, 0xc000063ee8, 0x0, 0x0)
    /usr/lib/go-1.13/src/path/filepath/path.go:382 +0x2ff
path/filepath.walk(0xc00044d2f0, 0xb, 0x515800, 0xc000290750, 0xc000063ee8, 0x0, 0x0)
    /usr/lib/go-1.13/src/path/filepath/path.go:382 +0x2ff
path/filepath.walk(0xc00028b790, 0x9, 0x515800, 0xc000291ad0, 0xc000063ee8, 0x0, 0x0)
    /usr/lib/go-1.13/src/path/filepath/path.go:382 +0x2ff
path/filepath.walk(0xc000018180, 0x7, 0x515800, 0xc000097110, 0xc000063ee8, 0x0, 0x0)
    /usr/lib/go-1.13/src/path/filepath/path.go:382 +0x2ff
path/filepath.walk(0x7ffff48911bf, 0x6, 0x515800, 0xc000097040, 0xc000063ee8, 0x0, 0x10)
    /usr/lib/go-1.13/src/path/filepath/path.go:382 +0x2ff
path/filepath.Walk(0x7ffff48911bf, 0x6, 0xc00009eee8, 0x4abc32, 0xc000074180)
    /usr/lib/go-1.13/src/path/filepath/path.go:404 +0xff
main.parseSmaliFiles(0x7ffff48911bf, 0x6)
    /home/vftdan/git/smali2java/smali2java.go:29 +0x72
main.main()
    /home/vftdan/git/smali2java/smali2java.go:23 +0xe8
AnotherZane commented 4 years ago

Got this as well, exactly the same error.

Raleose commented 3 years ago

Got this as well, exactly the same error.

me too. maybe it's because apktool gave me two folders with smali files? I tried pointing to the directory above, but still an error. what am I doing wrong? go version изображение

kasnder commented 3 years ago

Also have the error and multiple smali folders. I tried merging all files into one, but without success. The error remains.

petzah commented 3 years ago

I got this error too (actually twice for 2 different reasons). First was a "native" method (see #19 ).

.method private native nativeFinalize()V

The second one was:

.method public varargs abstract logMessage(Lcom/company/debug/debugoverlay/model/DebugOverlayTag;Ljava/lang/String;[Ljava/lang/Object;)V

which is kind of "ordering" issue. See workaround in 33338c8

AlexeySoshin commented 3 years ago

Both issues should be addressed by contributions now.