Closed GoogleCodeExporter closed 9 years ago
Original comment by Brut.alll
on 28 Nov 2011 at 11:18
No, I was wrong ;-)
Original comment by Brut.alll
on 28 Nov 2011 at 11:23
Hi,
I have been facing the same issue. I am using Windows XP 32-bit with
apktoolv1.4.1. Whenever I run the command apktool d -d test.apk test, I get the
following:
I: Baksmaling...
I: Loading resource table...
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String ind
ex out of range: 33121
at java.lang.String.substring(Unknown Source)
at brut.androlib.res.decoder.StringBlock.getHTML(StringBlock.java:161)
at brut.androlib.res.decoder.ARSCDecoder.readValue(ARSCDecoder.java:222)
at brut.androlib.res.decoder.ARSCDecoder.readEntry(ARSCDecoder.java:177)
at brut.androlib.res.decoder.ARSCDecoder.readConfig(ARSCDecoder.java:165
)
at brut.androlib.res.decoder.ARSCDecoder.readType(ARSCDecoder.java:130)
at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:10
5)
at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:82)
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:48)
at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibRes
ources.java:315)
at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.jav
a:50)
at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.jav
a:43)
at brut.androlib.Androlib.getResTable(Androlib.java:44)
at brut.androlib.ApkDecoder.getResTable(ApkDecoder.java:148)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:98)
at brut.apktool.Main.cmdDecode(Main.java:120)
at brut.apktool.Main.main(Main.java:57)
Please fix this and thankyou for the excellent tool.
Original comment by naresh.m...@gmail.com
on 30 Nov 2011 at 3:02
Same problem here.
Original comment by jgom...@gmail.com
on 10 Nov 2013 at 11:00
These strings are exceeding the length of short with size values around 33590,
etc.
There is a note in ResourcesTypes.cpp, which I caught during research
/**
* Strings in UTF-16 format have length indicated by a length encoded in the
* stored data. It is either 1 or 2 characters of length data. This allows a
* maximum length of 0x7FFFFFF (2147483647 bytes), but if you're storing that
* much data in a string, you're abusing them.
*
* If the high bit is set, then there are two characters or 4 bytes of length
* data encoded. In that case, drop the high bit of the first character and
* add it together with the next character.
*/
During execution of decode() -> readTable() -> readPackage() -> readType() ->
readConfig() -> readEntry() -> readValue() -> getHTML()
We incorrectly assume without reading the note about the high set bit. This
occurs in StringBlock.java, in function getShort(). The function is returning a
short. So we need to create a newer function "decodeUtf16" or something and
update this to above spec. I feel this bug is also the reason many applications
that abuse string length are failing.
Original comment by connor.tumbleson
on 9 Feb 2014 at 6:56
https://github.com/iBotPeaches/Apktool/commit/ca314b9aaed6a6bac28dbb7d4c7b995728
eaac81
Fixed. Will be in next beta.
Original comment by connor.tumbleson
on 10 Feb 2014 at 1:25
Original issue reported on code.google.com by
ljb2...@gmail.com
on 14 Nov 2011 at 9:37Attachments: