{"record":{"id":"f8d79a9209b54191","repo":"asLody/VirtualApp","slug":"invalid-marker","errorCode":null,"errorMessage":"Invalid marker: ","messagePattern":"Invalid marker: ","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"VirtualApp/lib/src/main/java/com/lody/virtual/server/pm/installer/PackageInstallerSession.java","lineNumber":366,"sourceCode":"    }\n\n    @Override\n    public void removeSplit(String splitName) throws RemoteException {\n        if (TextUtils.isEmpty(params.appPackageName)) {\n            throw new IllegalStateException(\"Must specify package name to remove a split\");\n        }\n        try {\n            createRemoveSplitMarker(splitName);\n        } catch (IOException e) {\n            throw new IllegalStateException(e);\n        }\n    }\n\n    private void createRemoveSplitMarker(String splitName) throws IOException {\n        try {\n            final String markerName = splitName + REMOVE_SPLIT_MARKER_EXTENSION;\n            if (!FileUtils.isValidExtFilename(markerName)) {\n                throw new IllegalArgumentException(\"Invalid marker: \" + markerName);\n            }\n            final File target = new File(resolveStageDir(), markerName);\n            target.createNewFile();\n            Os.chmod(target.getAbsolutePath(), 0 /*mode*/);\n        } catch (ErrnoException e) {\n            throw new IOException(e);\n        }\n    }\n\n    @Override\n    public void close() throws RemoteException {\n        if (mActiveCount.decrementAndGet() == 0) {\n            mCallback.onSessionActiveChanged(this, false);\n        }\n    }\n\n    @Override\n    public void commit(IntentSender statusReceiver) throws RemoteException {","sourceCodeStart":348,"sourceCodeEnd":384,"githubUrl":"https://github.com/asLody/VirtualApp/blob/666fefcb5d3f39cc944001c3457c38ffd6544c87/VirtualApp/lib/src/main/java/com/lody/virtual/server/pm/installer/PackageInstallerSession.java#L348-L384","documentation":"removeSplit() records removal by creating a marker file named '<splitName>.removed' in the stage directory. createRemoveSplitMarker validates that marker name with FileUtils.isValidExtFilename and throws IllegalArgumentException('Invalid marker: ' + markerName) if the resulting split name would produce an illegal filename.","triggerScenarios":"Calling session.removeSplit(splitName) where splitName contains '/', '\\\\', or other characters invalid in an ext filename, so 'splitName + REMOVE_SPLIT_MARKER_EXTENSION' fails validation.","commonSituations":"Passing fully-qualified APK paths or resource URIs instead of bare split names (e.g. 'config.arm64' vs 'base.apk'); names built from untrusted input; typos including slashes in split identifiers.","solutions":["Pass the bare split name (as it appears in APK split naming, without path or '.apk').","Validate with FileUtils.isValidExtFilename(splitName) before calling removeSplit.","Normalize the input: strip directories and known extensions before composing the marker name."],"exampleFix":"// before\nsession.removeSplit(\"/sdcard/splits/split_config.xxhdpi.apk\"); // IllegalArgumentException\n\n// after\nString split = new File(\"/sdcard/splits/split_config.xxhdpi.apk\").getName();\nsplit = split.substring(0, split.length() - \".apk\".length());\nif (FileUtils.isValidExtFilename(split + \".removed\")) {\n    session.removeSplit(split);\n}","handlingStrategy":"validation","validationCode":"String marker = splitName + \".removed\";\nif (!FileUtils.isValidExtFilename(marker)) {\n    throw new IllegalArgumentException(\"Invalid split name: \" + splitName);\n}","typeGuard":"boolean isValidSplitName(String s) {\n    return s != null && !s.isEmpty() && FileUtils.isValidExtFilename(s + \".removed\");\n}","tryCatchPattern":"try {\n    session.removeSplit(splitName);\n} catch (IllegalArgumentException e) {\n    // sanitize: strip path/extension and retry once\n}","preventionTips":["Pass bare split names (no paths, no .apk extension).","Sanitize split names derived from file paths or external input.","Whitelist known split names from the installed base APK when possible."],"tags":["illegal-argument","filename-validation","split-apk","android"],"backgroundTag":"invalid-identifier-format","analyzedSha":"666fefcb5d3f39cc944001c3457c38ffd6544c87","analyzedAt":"2026-09-09T11:09:01.694Z","contentChangedAt":"2026-09-09T11:09:01.694Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}