summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-04-13 22:47:42 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-04-13 22:47:42 +0000
commit5df681db00cdc7dac638611f3fe76076290d78b2 (patch)
treea91d02be5bfee3b50e8286b5626df83b69bb9255
parentb2e8c5a20709ff8273236ab76f3a2caa9b83630e (diff)
parent8b1517ced6a294f479e261961d03c7356dec0838 (diff)
downloadnative-oreo-m2-s1-release.tar.gz
Merge cherrypicks of [3898937, 3898958, 3899077, 3897885, 3898496, 3898245, 3898959, 3898960, 3897790, 3898312, 3898313, 3898314, 3899155, 3899156, 3899157, 3898289, 3898290, 3899061, 3898291, 3898292, 3896951, 3899158, 3898961, 3898938, 3898246] into sparse-4657601-L30800000163316240android-8.1.0_r33android-8.1.0_r25oreo-m2-s1-release
Change-Id: Ic0d6e84bbc01ff709ad9fc8eb646e4c53453ebe2
-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;