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

Commit 8cb610e2 authored by Ryo Hashimoto's avatar Ryo Hashimoto
Browse files

Fix buffer size check in replyRead

We should not reject it when size==array.size().
Replace CHECK with CHECK_GE/LE for better logging.

Bug: 38360920
Test: atest StorageManagerTest#testOpenProxyFileDescriptor_largeRead

Change-Id: I5eae40f22aaaea50299260d5b25c454bf794d780
parent cb7b04a5
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -166,8 +166,8 @@ void com_android_internal_os_FuseAppLoop_replyWrite(
void com_android_internal_os_FuseAppLoop_replyRead(
        JNIEnv* env, jobject self, jlong ptr, jlong unique, jint size, jbyteArray data) {
    ScopedByteArrayRO array(env, data);
    CHECK(size >= 0);
    CHECK(static_cast<size_t>(size) < array.size());
    CHECK_GE(size, 0);
    CHECK_LE(static_cast<size_t>(size), array.size());
    if (!reinterpret_cast<fuse::FuseAppLoop*>(ptr)->ReplyRead(unique, size, array.get())) {
        reinterpret_cast<fuse::FuseAppLoop*>(ptr)->Break();
    }