Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d76b1fd4 authored by Rongxuan Liu's avatar Rongxuan Liu
Browse files

[le audio] Broadcast code parcel fix for zero code length

If broadcast code is empty with 0 length, the code will proceed with serializing with 0 len.
But when deserializing, readByteArray will be ignored if codeLen is zero.
This might cause NullPointerException and concurrent TimeoutException.
The fix is to consider 0 length case.

Bug: 272386069
Test: atest BluetoothLeBroadcastMetadataTest
Test: atest BluetoothLeBroadcastReceiveStateTest
Test: atest BluetoothLeBroadcastSettingsTest

Change-Id: Ide8380efeb21103c56a80cc63a7d355afd4e980e
parent e2c4760a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -405,7 +405,7 @@ public final class BluetoothLeBroadcastMetadata implements Parcelable {
            byte[] broadcastCode = null;
            if (codeLen != -1) {
                broadcastCode = new byte[codeLen];
                if (codeLen > 0) {
                if (codeLen >= 0) {
                    in.readByteArray(broadcastCode);
                }
            }
+1 −1
Original line number Diff line number Diff line
@@ -191,7 +191,7 @@ public final class BluetoothLeBroadcastSettings implements Parcelable {
                    byte[] broadcastCode = null;
                    if (codeLen != -1) {
                        broadcastCode = new byte[codeLen];
                        if (codeLen > 0) {
                        if (codeLen >= 0) {
                            in.readByteArray(broadcastCode);
                        }
                    }