summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-03-22 20:42:51 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-03-22 20:42:51 +0000
commite3168307bcd1c827c0d3ba15961aa1c9990cbe11 (patch)
treea91d02be5bfee3b50e8286b5626df83b69bb9255
parente551aa4127312e2bf9980499c0ea65c2ac36b6bf (diff)
parent90bddcf0525eca7e70b558a6caf33aca3a4dec96 (diff)
downloadnative-e3168307bcd1c827c0d3ba15961aa1c9990cbe11.tar.gz
Merge cherrypicks of [3782287, 3782954, 3783025, 3783026, 3783027, 3783028, 3783029, 3783030, 3783164, 3783165, 3783167, 3783168, 3783170, 3783171, 3783172, 3782288, 3783031, 3782196, 3782955] into oc-m4-release
Change-Id: I829c1af8a0e059880daf61bdd4aca5cc9132c345
-rw-r--r--services/sensorservice/SensorService.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index dc491d97c0..e5b6dcf750 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -21,6 +21,7 @@
#include <cutils/properties.h>
#include <hardware/sensors.h>
#include <hardware_legacy/power.h>
+#include <log/log.h>
#include <openssl/digest.h>
#include <openssl/hmac.h>
#include <openssl/rand.h>
@@ -993,10 +994,15 @@ sp<ISensorEventConnection> SensorService::createSensorDirectConnection(
// check specific to memory type
switch(type) {
case SENSOR_DIRECT_MEM_TYPE_ASHMEM: { // channel backed by ashmem
+ if (resource->numFds < 1) {
+ ALOGE("Ashmem direct channel requires a memory region to be supplied");
+ android_errorWriteLog(0x534e4554, "70986337"); // SafetyNet
+ return nullptr;
+ }
int fd = resource->data[0];
int size2 = ashmem_get_size_region(fd);
// check size consistency
- if (size2 < static_cast<int>(size)) {
+ if (size2 < static_cast<int64_t>(size)) {
ALOGE("Ashmem direct channel size %" PRIu32 " greater than shared memory size %d",
size, size2);
return nullptr;