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

Commit 90b13ed7 authored by Prerepa Viswanadham's avatar Prerepa Viswanadham
Browse files

Protect from malformed advt with invalid manf_id/data combo

Bug: 16979645
Change-Id: Ie7ea00ed20cbad1120c7582bb2bafd44b4295052
parent ffabc511
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -257,9 +257,11 @@ public final class ScanRecord {
            }
            return new ScanRecord(serviceUuids, manufacturerData, serviceData,
                    advertiseFlag, txPowerLevel, localName, scanRecord);
        } catch (IndexOutOfBoundsException e) {
        } catch (Exception e) {
            Log.e(TAG, "unable to parse scan record: " + Arrays.toString(scanRecord));
            return null;
            // As the record is invalid, ignore all the parsed results for this packet
            // and return an empty record with raw scanRecord bytes in results
            return new ScanRecord(null, null, null, -1, Integer.MIN_VALUE, null, scanRecord);
        }
    }