kuter007 / android-apktool

Automatically exported from code.google.com/p/android-apktool
Other
0 stars 0 forks source link

StringBlock isn't Thread Safe #601

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
We are using the apktool in an multithreaded enviroment. When using it single 
threaded it works fine for us. When running it multithreaded its crashing with 
the following stack:

java.lang.IllegalStateException: Current state = RESET, new state = FLUSHED
    at java.nio.charset.CharsetDecoder.throwIllegalStateException(CharsetDecoder.java:968)
    at java.nio.charset.CharsetDecoder.flush(CharsetDecoder.java:657)
    at java.nio.charset.CharsetDecoder.decode(CharsetDecoder.java:786)
    at brut.androlib.res.decoder.StringBlock.decodeString(StringBlock.java:279)
    at brut.androlib.res.decoder.StringBlock.getString(StringBlock.java:110)
    at brut.androlib.res.decoder.ARSCDecoder.readEntry(ARSCDecoder.java:191)
    at brut.androlib.res.decoder.ARSCDecoder.readConfig(ARSCDecoder.java:167)
    at brut.androlib.res.decoder.ARSCDecoder.readType(ARSCDecoder.java:133)
    at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:108)
    at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:81)
    at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:49)
    at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:540)
    at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:76)
    at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:68)
    at brut.androlib.Androlib.getResTable(Androlib.java:51)
    at brut.androlib.ApkDecoder.getResTable(ApkDecoder.java:191)

With the attached patch the issue dissappears.

Original issue reported on code.google.com by alued...@testobject.com on 7 Feb 2014 at 1:09

Attachments:

GoogleCodeExporter commented 9 years ago
https://code.google.com/p/android-apktool/source/detail?r=e48ab8b9b943ede435e61e
4ef1ecdde7440e8e40&name=wip-2.0

Original comment by connor.tumbleson on 7 Feb 2014 at 1:35