BufferedInputStream: Allow jumping backwards to an already processed position #2344
BufferedInputStream: Allow jumping backwards to an already processed position #2344skylot merged 1 commit intoskylot:masterfrom
Conversation
…pe chunk entries are not ordered properly (see skylot#2343).
skylot
left a comment
There was a problem hiding this comment.
Looks good to me 👍
But seems that in most cases input in ParserStream already a BufferedInputStream, so we're just increasing its buffer size.
Anyway, it is fine as a workaround, but we will need to migrate to byte array anyway because this way it is closer to Android code with jumps to offsets. This shouldn't be hard, we just need to change ParserStream implementation.
|
@skylot I checked the usages and in most cases the InputStream came directly from ZIP file. Only one case used BufferedInputStream (which I removed in this PR). I see. resources.arsc is stored without compression in the ZIP file. So Android directly maps the ZIP file data to memory and operates on it. |
Everything should be from here: jadx/jadx-core/src/main/java/jadx/api/plugins/utils/ZipSecurity.java Lines 115 to 122 in 964bd62 otherwise it is not secured/checked and should be fixed. |
Some APK resources.arsc seem to use disordered entries, which collides with our approach to read them sequentially from the InputStream.
As a workaround this PR introduces a BufferedInputStream and mark/reset support for
ParserStreamwhich allows us to jump back (up to 32k) in stream to read the disordered type chunk entries.fixes #2343