NPE from bMessage MIME parsing crashes BT
When a Pixel phone receives a MMS that contains only an image and no text, it will replace the image data with a text string (e.g., filename) in the bMessage (if the MAP client specified "no attachments" option). However, the Pixel does not set the charset encoding to UTF-8 in this case. When the MAP client receives a bMessage that does not specify a charset encoding, it will set the message body to NULL, leading to a NPE that crashes the BT stack when the MAP client tries to parse a NULL string. This CL introduces fixes at two points, each of which in isolation prevents the NPE and BT from crashing. First, instead of setting the message body to NULL when the UTF-8 check fails, it is set to a non-UTF-8 encoded string, since the previous assumption that MMS will always be text-only is no longer valid. The end effect from this change is the user now sees the replacement text string, e.g., filename. Second, as an additional failsafe against BT crashing, a NULL-check is added before any string parsing begins. The end effect from this change is the user will see a message with an empty-string body. Given the first fix, this second fix should not be triggered. Tag: #stability Bug: 144759976 Test: atest BluetoothMapbMessageMimeTest Test: Send an image-only MMS to the remote device. A notification on the carkit should appear indicating a message has been received, where the image has been replaced with a text string. Change-Id: I9c2907d6fc42594382cc1eebdf0bcd49cdc44cac
Loading
Please register or sign in to comment
