{"record":{"id":"1d5e571e34d8924e","repo":"Tencent/tinker","slug":"res-meta-corrupted-1d5e57","errorCode":null,"errorMessage":"res meta Corrupted:","messagePattern":"res meta Corrupted:","errorType":"exception","errorClass":"TinkerRuntimeException","httpStatus":null,"severity":"error","filePath":"tinker-android/tinker-android-loader/src/main/java/com/tencent/tinker/loader/shareutil/ShareResPatchInfo.java","lineNumber":161,"sourceCode":"        if (input.contains(\"?\")) {\n            input = input.replaceAll(\"\\\\?\", \"\\\\.\");\n        }\n        //convert * to.*\n        if (input.contains(\"*\")) {\n            input = input.replace(\"*\", \".*\");\n        }\n        Pattern pattern = Pattern.compile(input);\n        return pattern;\n    }\n\n    public static void parseResPatchInfoFirstLine(String meta, ShareResPatchInfo info) {\n        if (meta == null || meta.length() == 0) {\n            return;\n        }\n        String[] lines = meta.split(\"\\n\");\n        String firstLine = lines[0];\n        if (firstLine == null || firstLine.length() <= 0) {\n            throw new TinkerRuntimeException(\"res meta Corrupted:\" + meta);\n        }\n        final String[] kv = firstLine.split(\",\", 3);\n        info.arscBaseCrc = kv[1];\n        info.resArscMd5 = kv[2];\n    }\n\n    @Override\n    public String toString() {\n        StringBuffer sb = new StringBuffer();\n        sb.append(\"resArscMd5:\" + resArscMd5 + \"\\n\");\n        sb.append(\"arscBaseCrc:\" + arscBaseCrc + \"\\n\");\n\n        for (Pattern pattern : patterns) {\n            sb.append(\"pattern:\" + pattern + \"\\n\");\n        }\n        for (String add : addRes) {\n            sb.append(\"addedSet:\" + add + \"\\n\");\n        }","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/Tencent/tinker/blob/1b7ea02c239840f563ea64fb5bd286eb98d4011e/tinker-android/tinker-android-loader/src/main/java/com/tencent/tinker/loader/shareutil/ShareResPatchInfo.java#L143-L179","documentation":"ShareResPatchInfo.parseResPatchInfoFirstLine splits the first line of res_meta.txt and requires it non-empty. An empty first line (after split) throws TinkerRuntimeException(\"res meta Corrupted:\" + meta). Additionally the code then indexes kv[1] and kv[2] without length checks, so malformed lines surface as AIOOBE right after. Either way the resource patch meta is not in the expected 'dir,arscCrc,resArscMd5' format.","triggerScenarios":"parseResPatchInfoFirstLine(meta, info) with a meta whose first line is empty, whitespace, or has fewer than 3 comma-separated fields.","commonSituations":"Patch built by a mismatched plugin/loader version; edited or corrupted res_meta.txt; a patch containing only resource changes produced by a nonstandard pipeline.","solutions":["Match the gradle plugin and loader versions and rebuild the patch.","Never edit files inside the produced patch package.","Pre-validate the meta line: non-empty and split(',').length >= 3 before calling.","Catch TinkerRuntimeException during patch load and reject the package as corrupted."],"exampleFix":"// before\nString firstLine = lines[0];\n// after\nString firstLine = lines[0];\nif (firstLine == null || firstLine.trim().isEmpty() || firstLine.split(\",\").length < 3) {\n    throw new TinkerRuntimeException(\"res meta Corrupted:\" + meta);\n}","handlingStrategy":"validation","validationCode":"String firstLine = meta.split(\"\\n\")[0];\nif (firstLine == null || firstLine.trim().isEmpty() || firstLine.split(\",\", -1).length < 3) {\n    // reject resource patch before parseResPatchInfoFirstLine\n}","typeGuard":null,"tryCatchPattern":"try {\n    ShareResPatchInfo.parseResPatchInfoFirstLine(meta, info);\n} catch (TinkerRuntimeException | ArrayIndexOutOfBoundsException e) {\n    // corrupted res meta: reject patch package\n}","preventionTips":["Validate meta line shape (>=3 comma fields) before parsing.","Never hand-edit or rezip patch packages after build.","Keep plugin and loader versions aligned."],"tags":["android","tinker","resources","patch-meta","validation"],"backgroundTag":null,"analyzedSha":"1b7ea02c239840f563ea64fb5bd286eb98d4011e","analyzedAt":"2026-08-14T15:16:52.110Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}