CVE-2026-55265 AI-generated analysis
platform/frameworks/base, telephony/common MMS PDU parser (com.google.android.mms.pdu.PduParser); plus the ApiDemos copy in platform/development (samples/ApiDemos com.example.android.mmslib.pdu.PduParser)
Adds length-vs-available bounds checks (new isInvalidLength helper) in PduParser.parseParts, skipWapValue and parsePartHeaders and replaces the byte[length] allocation in skipWapValue with ByteArrayInputStream.skip(), so malformed MMS PDUs with huge declared lengths no longer trigger OutOfMemoryError.
Root cause
PduParser took integer lengths from the PDU without checking them against the bytes actually available in the ByteArrayInputStream. These were the parseUnsignedInt results headerLength and dataLength in parseParts, the length passed to skipWapValue, and the computed remainder 'last' in parsePartHeaders. skipWapValue did 'byte[] area = new byte[length]' before reading, and parsePartHeaders did 'byte[] temp = new byte[last]', so a PDU declaring a huge length could cause an OutOfMemoryError during parsing instead of a parse failure (per the commit message). The regression test uses a part header length of 0x7FFFFFFF.
How the fix works
- [1] frameworks/base telephony/common/com/google/android/mms/pdu/PduParser.java: new private static helper isInvalidLength(int length, ByteArrayInputStream pduDataStream) returning true when length < 0 or length > pduDataStream.available().
- [1] PduParser.parseParts: headerLength and dataLength are each checked with isInvalidLength right after being read with parseUnsignedInt. On failure an error is logged and parseParts returns null. The test asserts that parser.parse() returns null for a 0x7FFFFFFF header length.
- [1] PduParser.skipWapValue: first validates length with isInvalidLength and returns -1 on failure. It then calls pduDataStream.skip(length) instead of allocating byte[length] and reading into it. It returns -1 if fewer bytes were skipped than requested, otherwise the skipped count cast to int.
- [1] PduParser.parsePartHeaders: in the over-read recovery path, 'last' is checked with isInvalidLength before 'byte[] temp = new byte[last]'. On failure it logs and returns false.
- [1] tests/TelephonyCommonTests/.../PduParserTest.java: the diff only moves the @SmallTest annotation from the class to the test method testParse_malformedHugeHeaderLength_doesNotOOM. The test body appears as context, so it already existed in the pre-image.
- [2] development samples/ApiDemos/src/com/example/android/mmslib/pdu/PduParser.java: the same set of changes is applied to the ApiDemos copy. Its isInvalidLength also returns true when pduDataStream == null.
Completeness
- Covers the length sites touched by the diff: parseParts (headerLength, dataLength), skipWapValue (the skipped value) and the recovery allocation in parsePartHeaders.
- The check is length > available(), which bounds lengths to the remaining input buffer. It adds no absolute cap.
- The frameworks/base isInvalidLength does not null-check pduDataStream, while the ApiDemos copy does. parseParts returns early on a null stream and skipWapValue asserts non-null.
- The material does not show other allocation sites in PduParser that size arrays from PDU-derived lengths, and this diff does not modify any. Whether they are already guarded is unknown.
- Index search shows a third copy of the parser in packages/apps/Messaging with the same pre-fix skipWapValue body (see potential_variants). The material contains no fix for it.
Behavior changes
- parseParts now returns null and logs 'parseParts: Invalid header length' or 'parseParts: Invalid data length' when a part's declared header or data length is negative or larger than the remaining bytes.
- skipWapValue returns -1 with an error log for invalid lengths and no longer allocates. For valid input it still returns the number of bytes skipped.
- parsePartHeaders returns false instead of allocating when the computed remainder 'last' is invalid.
- New Log.e lines in the three paths.
- Test-only: in PduParserTest the @SmallTest annotation moves from the class to the method.
Per major
- Android 14: same fix: platform/frameworks/base f495e37b88fc in android-security-14.0.0_r31. The hunks are identical to the Android 15 commit (the file mode shown is 100755); 8/8 lines of the patched region present.
- Android 15: same fix: platform/frameworks/base 6a726620f45b in android-security-15.0.0_r19, plus platform/development 3ef538f8bac9 for the ApiDemos copy; 8/8 lines of the patched region present.
- Android 16: fixed: resolved by bug_id at android-security-16.0.0_r10. The material shows fix commit platform/development b842484f5459 (ApiDemos copy) there; 8/8 lines of the patched region present. No frameworks/base commit hash is listed for 16.
- Android 17: same fix: platform/frameworks/base 61b14cfb3390 in android-security-17.0.0_r3. The pre-image blob is different (d2f23026e5d8) but the hunks are identical; 8/8 lines of the patched region present.
Unknowns
- The exact entry point or delivery path by which an untrusted PDU reaches PduParser.
- How parseParts used headerLength and dataLength before the fix, beyond the missing validation.
- Whether other PDU-length-driven allocations in PduParser, outside the three patched sites, are already bounds-checked.
- The frameworks/base commit hash for Android 16; only the development commit is listed for android-security-16.0.0_r10.
- Whether the hunks apply cleanly on trees without the recursion-depth guard.
- Why the bulletin rates this DoS as Critical.