mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-12-13 09:54:36 -05:00
59bf3b75c7
https://review.lineageos.org/c/LineageOS/android_frameworks_base/+/353117 https://review.lineageos.org/q/topic:Q_asb_2023-03 https://review.lineageos.org/q/topic:Q_asb_2023-04 https://review.lineageos.org/q/topic:Q_asb_2023-05 https://review.lineageos.org/q/topic:Q_asb_2023-06 https://review.lineageos.org/q/topic:Q_asb_2023-07 https://review.lineageos.org/q/topic:Q_asb_2023-08 accounted for via patches: https://review.lineageos.org/c/LineageOS/android_system_ca-certificates/+/376560 https://review.lineageos.org/c/LineageOS/android_system_ca-certificates/+/376561 https://review.lineageos.org/c/LineageOS/android_system_ca-certificates/+/376562 https://review.lineageos.org/q/topic:Q_asb_2023-09 https://review.lineageos.org/q/topic:Q_asb_2023-10 https://review.lineageos.org/q/topic:Q_asb_2023-11 accounted for via patches: https://review.lineageos.org/c/LineageOS/android_system_ca-certificates/+/376563 accounted for via manifest change: https://review.lineageos.org/c/LineageOS/android_external_webp/+/376568 https://review.lineageos.org/q/topic:Q_asb_2023-12 https://review.lineageos.org/q/topic:Q_asb_2024-01 https://review.lineageos.org/q/topic:Q_asb_2024-02 https://review.lineageos.org/q/topic:Q_asb_2024-03 Signed-off-by: Tavi <tavi@divested.dev>
68 lines
2.5 KiB
Diff
68 lines
2.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Devin Moore <devinmoore@google.com>
|
|
Date: Fri, 17 Feb 2023 19:35:25 +0000
|
|
Subject: [PATCH] Remove some new memory leaks from SensorManager
|
|
|
|
After catching an error in Sensor::unflatten, there are memory leaks
|
|
caught by the fuzzer in the same test case.
|
|
|
|
Test: libsensorserviceaidl_fuzzer with testcase from bug
|
|
Bug: 269014004
|
|
Merged-In: I509cceb41f56ca117d9475f6f6674244560fe582
|
|
Change-Id: I509cceb41f56ca117d9475f6f6674244560fe582
|
|
(cherry picked from commit c95fa0f0e7c7b73746ff850b85a79fc5f92b784e)
|
|
Merged-In: I509cceb41f56ca117d9475f6f6674244560fe582
|
|
(cherry picked from commit on googleplex-android-review.googlesource.com host: ceb0d52273256c6a5c5622bf81b0ac4ba106faa1)
|
|
Merged-In: I509cceb41f56ca117d9475f6f6674244560fe582
|
|
---
|
|
libs/sensor/ISensorServer.cpp | 12 ++++++++++--
|
|
libs/sensor/SensorManager.cpp | 5 +++++
|
|
2 files changed, 15 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/libs/sensor/ISensorServer.cpp b/libs/sensor/ISensorServer.cpp
|
|
index 5200545a53..b2f1ba2507 100644
|
|
--- a/libs/sensor/ISensorServer.cpp
|
|
+++ b/libs/sensor/ISensorServer.cpp
|
|
@@ -66,7 +66,11 @@ public:
|
|
v.setCapacity(n);
|
|
while (n) {
|
|
n--;
|
|
- reply.read(s);
|
|
+ if(reply.read(s) != OK) {
|
|
+ ALOGE("Failed to read reply from getSensorList");
|
|
+ v.clear();
|
|
+ break;
|
|
+ }
|
|
v.add(s);
|
|
}
|
|
return v;
|
|
@@ -84,7 +88,11 @@ public:
|
|
v.setCapacity(n);
|
|
while (n) {
|
|
n--;
|
|
- reply.read(s);
|
|
+ if(reply.read(s) != OK) {
|
|
+ ALOGE("Failed to read reply from getDynamicSensorList");
|
|
+ v.clear();
|
|
+ break;
|
|
+ }
|
|
v.add(s);
|
|
}
|
|
return v;
|
|
diff --git a/libs/sensor/SensorManager.cpp b/libs/sensor/SensorManager.cpp
|
|
index 96d5eb9d1f..e09672c9a4 100644
|
|
--- a/libs/sensor/SensorManager.cpp
|
|
+++ b/libs/sensor/SensorManager.cpp
|
|
@@ -162,6 +162,11 @@ status_t SensorManager::assertStateLocked() {
|
|
|
|
mSensors = mSensorServer->getSensorList(mOpPackageName);
|
|
size_t count = mSensors.size();
|
|
+ if (count == 0) {
|
|
+ ALOGE("Failed to get Sensor list");
|
|
+ mSensorServer.clear();
|
|
+ return UNKNOWN_ERROR;
|
|
+ }
|
|
mSensorList =
|
|
static_cast<Sensor const**>(malloc(count * sizeof(Sensor*)));
|
|
LOG_ALWAYS_FATAL_IF(mSensorList == nullptr, "mSensorList NULL");
|