notishell/smali

org.jf.util.ExceptionWithContext: Field index out of bounds: 27491

Closed this issue · 2 comments

What seems to be the problem?

[Smali 1.x]
Exception in thread "main" org.jf.dexlib.Util.ExceptionWithContext: Index: 
27491, Size: 4776
        at org.jf.dexlib.Util.ExceptionWithContext.withContext(ExceptionWithContext.java:54)
        at org.jf.dexlib.IndexedSection.getItemByIndex(IndexedSection.java:77)
        at org.jf.dexlib.Code.InstructionWithReference.lookupReferencedItem(InstructionWithReference.java:79)
        at org.jf.dexlib.Code.InstructionWithReference.<init>(InstructionWithReference.java:57)
        at org.jf.dexlib.Code.Format.Instruction21c.<init>(Instruction21c.java:63)
        at org.jf.dexlib.Code.Format.Instruction21c.<init>(Instruction21c.java:40)
        at org.jf.dexlib.Code.Format.Instruction21c$Factory.makeInstruction(Instruction21c.java:112)
        at org.jf.dexlib.Code.InstructionIterator.IterateInstructions(InstructionIterator.java:82)
        at org.jf.dexlib.CodeItem.readItem(CodeItem.java:154)
        at org.jf.dexlib.Item.readFrom(Item.java:77)
        at org.jf.dexlib.OffsettedSection.readItems(OffsettedSection.java:48)
        at org.jf.dexlib.Section.readFrom(Section.java:143)
        at org.jf.dexlib.DexFile.<init>(DexFile.java:431)
        at org.jf.dexlib.DexFile.<init>(DexFile.java:267)
        at brut.androlib.src.SmaliDecoder.decode(SmaliDecoder.java:45)
        at brut.androlib.src.SmaliDecoder.decode(SmaliDecoder.java:32)
        at brut.androlib.Androlib.decodeSourcesSmali(Androlib.java:72)
        at brut.androlib.ApkDecoder.decode(ApkDecoder.java:89)
        at brut.apktool.Main.cmdDecode(Main.java:146)
        at brut.apktool.Main.main(Main.java:77)
Caused by: java.lang.IndexOutOfBoundsException: Index: 27491, Size: 4776
        at java.util.ArrayList.rangeCheck(Unknown Source)
        at java.util.ArrayList.get(Unknown Source)
        at org.jf.dexlib.IndexedSection.getItemByIndex(IndexedSection.java:75)
        ... 18 more
Error occured while retrieving the field_id_item item at index 27491
Error occured at code address 12
code_item @0x28c34

[Smali 2.x]
Error occured while disassembling class Lё; - skipping class
org.jf.util.ExceptionWithContext: Field index out of bounds: 27491
    at org.jf.dexlib2.dexbacked.DexBackedDexFile.getFieldIdItemOffset(DexBackedDexFile.java:180)
    at org.jf.dexlib2.dexbacked.reference.DexBackedFieldReference.<init>(DexBackedFieldReference.java:46)
    at org.jf.dexlib2.dexbacked.reference.DexBackedReference.makeReference(DexBackedReference.java:51)
    at org.jf.dexlib2.dexbacked.instruction.DexBackedInstruction21c.getReference(DexBackedInstruction21c.java:54)
    at org.jf.baksmali.Adaptors.Format.InstructionMethodItem.writeReference(InstructionMethodItem.java:339)
    at org.jf.baksmali.Adaptors.Format.InstructionMethodItem.writeTo(InstructionMethodItem.java:113)
    at org.jf.baksmali.Adaptors.MethodDefinition.writeTo(MethodDefinition.java:180)
    at org.jf.baksmali.Adaptors.ClassDefinition.writeDirectMethods(ClassDefinition.java:269)
    at org.jf.baksmali.Adaptors.ClassDefinition.writeTo(ClassDefinition.java:104)
    at org.jf.baksmali.baksmali.disassembleClass(baksmali.java:169)
    at org.jf.baksmali.baksmali.access$000(baksmali.java:47)
    at org.jf.baksmali.baksmali$1.call(baksmali.java:95)
    at org.jf.baksmali.baksmali$1.call(baksmali.java:93)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)

What is the exact smali/baksmali command that you ran?
./baksmali problemapk.apk

What version of smali/baksmali are you using? What rom are you working
from?
2b5

What is the airspeed velocity of an unladen swallow?
125.22mph


Please provide any additional information below: error messages, symptoms,
etc.

Original issue reported on code.google.com by connor.tumbleson on 19 Aug 2013 at 11:27

d'oh

Original comment by connor.tumbleson on 19 Aug 2013 at 11:28

Attachments:

This seems to be working as intended. The one "bogus" class that has the index 
problem is skipped, and the rest of the apk is correctly disassembled.

Dalvik will refuse to verify the skipped class, so it would never be run anyway.

Original comment by jesusfreke@jesusfreke.com on 28 Aug 2013 at 5:05

  • Changed state: Fixed