{"record":{"id":"cc230781920c3b46","repo":"iBotPeaches/Apktool","slug":"jump-failed-skipped-s-bytes-expected-s","errorCode":null,"errorMessage":"Jump failed: skipped %s bytes (expected: %s)","messagePattern":"Jump failed: skipped (.+?) bytes \\(expected: (.+?)\\)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"brut.j.util/src/main/java/brut/util/BinaryDataInputStream.java","lineNumber":90,"sourceCode":"    public long position() {\n        return mPosition;\n    }\n\n    public long remaining() {\n        return mLimit - mPosition;\n    }\n\n    public long jumpTo(long pos) throws IOException {\n        long expected = pos - mPosition;\n        if (expected == 0) {\n            return 0;\n        }\n        if (expected < 0) {\n            throw new IOException(String.format(\"Illegal backwards jump from %s to %s\", mPosition, pos));\n        }\n        long skipped = skip(expected);\n        if (skipped != expected) {\n            throw new IOException(String.format(\"Jump failed: skipped %s bytes (expected: %s)\", skipped, expected));\n        }\n        return skipped;\n    }\n\n    public void skipByte() throws IOException {\n        //noinspection ResultOfMethodCallIgnored\n        readByte();\n    }\n\n    public void skipShort() throws IOException {\n        //noinspection ResultOfMethodCallIgnored\n        readShort();\n    }\n\n    public void skipInt() throws IOException {\n        //noinspection ResultOfMethodCallIgnored\n        readInt();\n    }","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/iBotPeaches/Apktool/blob/79b63384d7d7e22917e6ea8b453272da7012515b/brut.j.util/src/main/java/brut/util/BinaryDataInputStream.java#L72-L108","documentation":"BinaryDataInputStream.jumpTo(pos) asked the underlying stream to skip forward, but skip() returned fewer bytes than requested — the stream ended first. This indicates a truncated file: the target offset lies past the end of the data actually available.","triggerScenarios":"A resources.arsc or binary XML whose chunk offsets extend beyond the file/entry length — cut-off downloads, entries truncated by repacking tools, or length fields lying about the real data size.","commonSituations":"APKs truncated in transit, ZIP entries damaged by bad repack pipelines, protected apps whose resource tables are deliberately mangled.","solutions":["Confirm archive integrity: `unzip -t app.apk` must pass with no CRC errors","Re-obtain the APK from a trusted source and compare size/hash","Update apktool in case newer releases tolerate/handle the table layout in question","If the file is intentionally malformed (protector), you cannot decode it as-is; get the unprotected original"],"exampleFix":"# before\napktool d truncated.apk   # Jump failed: skipped 120 bytes (expected: 4096)\n\n# after\nunzip -t truncated.apk      # shows CRC/bad zipfile errors\n# re-download / re-pull the APK, then\napktool d intact.apk","handlingStrategy":"validation","validationCode":"// Bound-check target offsets against the stream's known length\nlong remaining = in.remaining();\nif (pos - in.position() > remaining) {\n    throw new EOFException(\"Offset \" + pos + \" beyond end of data (\" + remaining + \" bytes left)\");\n}\nin.jumpTo(pos);","typeGuard":null,"tryCatchPattern":"try {\n    in.jumpTo(pos);\n} catch (IOException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Jump failed\")) {\n        // truncated input: no retry can help; fail with the file identity for upstream reporting\n        throw new IllegalStateException(\"Truncated resource data in \" + sourceFile, e);\n    }\n    throw e;\n}","preventionTips":["Validate file size/CRC before parsing","Compare downloaded file hashes with the source manifest","Treat 'skipped < expected' as corruption, never as a transient error"],"tags":["apktool","parsing","truncated-file","stream"],"backgroundTag":null,"analyzedSha":"79b63384d7d7e22917e6ea8b453272da7012515b","analyzedAt":"2026-08-14T10:43:28.812Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}