Skip to content

Commit c225c2b

Browse files
authored
Check for NPE when bad data is passed to the PDUParser.
1 parent ff76c5f commit c225c2b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

app/src/main/java/org/thoughtcrime/securesms/mms/IncomingLollipopMmsConnection.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,14 @@ public synchronized void onResult(Context context, Intent intent) {
126126
Bundle configValues = smsManager.getCarrierConfigValues();
127127
boolean parseContentDisposition = configValues.getBoolean(SmsManager.MMS_CONFIG_SUPPORT_MMS_CONTENT_DISPOSITION);
128128

129-
RetrieveConf retrieved = (RetrieveConf) new PduParser(baos.toByteArray(), parseContentDisposition).parse();
129+
RetrieveConf retrieved;
130+
131+
try {
132+
retrieved = (RetrieveConf) new PduParser(baos.toByteArray(), parseContentDisposition).parse();
133+
} catch (NullPointerException e) {
134+
Log.w(TAG, "Badly formatted MMS message caused the parser to fail.", e);
135+
throw new MmsException(e);
136+
}
130137

131138
if (retrieved == null) return null;
132139

0 commit comments

Comments
 (0)