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

Commit 84c52a3c authored by Keisuke Kuroyanagi's avatar Keisuke Kuroyanagi
Browse files

Boundary check for ProximityInfoState::getProximityTypeG().

Bug: 12481052
Change-Id: Ic0b64d2fa17eb8f65f3ad1a7b468cdf6dddf7e70
parent d7660c6f
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -255,6 +255,14 @@ ProximityType ProximityInfoState::getProximityTypeG(const int index, const int c
    if (!isUsed()) {
        return UNRELATED_CHAR;
    }
    const int sampledSearchKeyVectorsSize = static_cast<int>(mSampledSearchKeyVectors.size());
    if (index < 0 || index >= sampledSearchKeyVectorsSize) {
        AKLOGE("getProximityTypeG() is called with an invalid index(%d). "
                "mSampledSearchKeyVectors.size() = %d, codePoint = %x.", index,
                sampledSearchKeyVectorsSize, codePoint);
        ASSERT(false);
        return UNRELATED_CHAR;
    }
    const int lowerCodePoint = CharUtils::toLowerCase(codePoint);
    const int baseLowerCodePoint = CharUtils::toBaseCodePoint(lowerCodePoint);
    for (int i = 0; i < static_cast<int>(mSampledSearchKeyVectors[index].size()); ++i) {