CVE-2026-58882 AI-generated analysis
platform/frameworks/opt/telephony, inbound SMS / WAP push handling (InboundSmsHandler, WapPushOverSms)
Broadens the exception handling in WapPushOverSms.decodeWapPdu from ArrayIndexOutOfBoundsException to RuntimeException, and wraps processMessagePart in the InboundSmsHandler EVENT_BROADCAST_SMS handler with a null check and a RuntimeException catch that marks the offending raw-table row deleted, so a malformed WAP push SMS no longer causes a persistent crash loop.
Root cause
WapPushOverSms.decodeWapPdu parses a remotely supplied WAP PDU with WspTypeDecoder inside a try block that only caught ArrayIndexOutOfBoundsException. Any other RuntimeException raised while decoding escaped decodeWapPdu and then dispatchWapPdu. It then passed through processMessagePart and reached the state machine's EVENT_BROADCAST_SMS case, which called processMessagePart with no exception handling and passed msg.obj without a null check. According to the commit message, the result was a persistent crash loop driven by a 'poison tracker' stored in the raw database.
How the fix works
- src/java/com/android/internal/telephony/WapPushOverSms.java : decodeWapPdu: the catch clause changes from ArrayIndexOutOfBoundsException to RuntimeException. The handler still logs the exception string (now 'ignoring decodeWapPdu() runtime exception: ') and sets result.statusCode = Intents.RESULT_SMS_GENERIC_ERROR, so dispatchWapPdu returns that code early instead of propagating the exception.
- src/java/com/android/internal/telephony/InboundSmsHandler.java : EVENT_BROADCAST_SMS case: adds a local 'success' flag initialised to false. If inboundSmsTracker is non-null, processMessagePart is called inside try/catch(RuntimeException). On an exception the handler logs 'Exception delivering message part' and calls deleteFromRawTable(inboundSmsTracker.getDeleteWhere(), inboundSmsTracker.getDeleteWhereArgs(), MARK_DELETED). If the tracker is null it logs 'EVENT_BROADCAST_SMS with null inboundSmsTracker'. The transition logic that follows now depends on 'success': when true it sends EVENT_UPDATE_TRACKER and moves to mWaitingState; when false it takes the existing else branch.
- Tests: WapPushOverSmsTest.testDispatchWapPdu_RuntimeExceptionInDecoder_failsGracefully makes mWspTypeDecoder.decodeContentType throw a RuntimeException and asserts RESULT_SMS_GENERIC_ERROR. GsmInboundSmsHandlerTest.testBroadcastSms_nullTracker_failsGracefully and testBroadcastSms_RuntimeExceptionInDecoder_deletesTracker assert that the handler returns to IdleState and that the raw row is marked deleted (the count of rows with deleted=0 goes from 1 to 0).
Completeness
- decodeWapPdu now absorbs every RuntimeException thrown inside its try block. java.lang.Error subclasses are not caught at either layer.
- The InboundSmsHandler catch wraps the whole processMessagePart call. It therefore also covers RuntimeExceptions from other delivery paths and from the part of dispatchWapPdu that runs after decodeWapPdu returns, which lies outside the decodeWapPdu try block.
- On an exception the raw row is marked deleted using the tracker's own delete-where clause, which stops that message from being re-processed. How deleteFromRawTable behaves with a null clause is not shown.
- Only the EVENT_BROADCAST_SMS case is guarded. Other state-machine events are not wrapped in this commit, and the material does not show whether they can reach the decoder.
- isWapPushForMms in WapPushOverSms is exercised by new tests on Android 15/16/17, but none of the diffs modify its code.
Behavior changes
- decodeWapPdu returns RESULT_SMS_GENERIC_ERROR for any RuntimeException during decoding, not only ArrayIndexOutOfBoundsException. The log string changes to 'ignoring decodeWapPdu() runtime exception: '.
- A RuntimeException that escapes processMessagePart is now caught. The message's raw-table row is marked deleted and the handler takes the failure branch (the tests assert it ends in IdleState), so the message is dropped.
- EVENT_BROADCAST_SMS with a null tracker is now logged and treated as a failure.
- New loge calls on both failure paths.
Per major
- Android 14: Same fix: commit 804a0e06d291 in android-security-14.0.0_r30, with identical source hunks in InboundSmsHandler.java (EVENT_BROADCAST_SMS) and WapPushOverSms.java (decodeWapPdu). The tests add the RuntimeException decoder test and the two GsmInboundSmsHandlerTest tests (null tracker, RuntimeException deletes tracker), but not the malformedHeaderLength, headerLengthExceedsPdu or isWapPushForMms tests. The decodeWapPdu change is visible at android-security-14.0.0_r31.
- Android 15: Same fix: commit 2ce2c3a8f95f in android-security-15.0.0_r18, with identical source hunks (line offsets differ). WapPushOverSmsTest also gains the malformedHeaderLength, headerLengthExceedsPdu and isWapPushForMms tests.
- Android 16: Same fix: commit 71a0600c8246 in android-security-16.0.0_r9, with identical source hunks and the same extended test set as 15. The test imports use org.mockito.ArgumentMatchers.
- Android 17: Same fix: commit 735d9672603f in android-security-17.0.0_r2, with identical source hunks and the same extended test set. GsmInboundSmsHandlerTest uses mContentResolver.insert instead of mContext.getContentResolver().insert.
Unknowns
- Which concrete RuntimeException type, and which WspTypeDecoder step, the malformed PDU in the report triggers.
- Whether isWapPushForMms, which has new tests on 15/16/17 but is not modified, has equivalent exception handling.
- How the pre-fix code behaved with a null tracker in EVENT_BROADCAST_SMS.
- The resolver reports 7/8 patched lines present at each latest security tag. The InboundSmsHandler EVENT_BROADCAST_SMS region is not in the provided context, so the missing line cannot be identified.
- How deleteFromRawTable behaves if the tracker's delete-where clause is null.