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

Commit 54aacdf9 authored by Devin Moore's avatar Devin Moore Committed by Cherrypicker Worker
Browse files

Check for malformed Sensor Flattenable

Test: libsensorserviceaidl_fuzzer with testcase from bug
Bug: 269014004
Merged-In: I0e255c64243c38876fb657cbf942fc1613363216
Change-Id: I0e255c64243c38876fb657cbf942fc1613363216
(cherry picked from commit aeec1802)
Merged-In: I0e255c64243c38876fb657cbf942fc1613363216
parent fd8f1371
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -612,7 +612,13 @@ bool Sensor::unflattenString8(void const*& buffer, size_t& size, String8& output
        return false;
    }
    outputString8.setTo(static_cast<char const*>(buffer), len);

    if (size < FlattenableUtils::align<4>(len)) {
        ALOGE("Malformed Sensor String8 field. Should be in a 4-byte aligned buffer but is not.");
        return false;
    }
    FlattenableUtils::advance(buffer, size, FlattenableUtils::align<4>(len));

    return true;
}