OSDN Git Service

Add bounds check to sensors direct channel creation
authorBrian Duddie <bduddie@google.com>
Thu, 15 Feb 2018 23:02:29 +0000 (15:02 -0800)
committerandroid-build-team Robot <android-build-team-robot@google.com>
Fri, 13 Apr 2018 22:46:52 +0000 (22:46 +0000)
commit8b1517ced6a294f479e261961d03c7356dec0838
treea91d02be5bfee3b50e8286b5626df83b69bb9255
parentb2e8c5a20709ff8273236ab76f3a2caa9b83630e
Add bounds check to sensors direct channel creation

Avoids attempting to read a 0-size array during input validation. Adds
SafetyNet logging when this is triggered.

Also, change the cast for the ashmem size check from int to int64_t to
avoid potential conversion to negative number on 32-bit systems.

Bug: 70986337
Test: run POC, confirm via logs that function bails early
Change-Id: I674285738983f18de3466f9e818d83dabe269b7d
(cherry picked from commit 0eb4624b33aeb375ae431a6b1e2b787c959968fe)
services/sensorservice/SensorService.cpp