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
This commit is contained in:
Ryo Hashimoto
2018-03-14 19:13:56 +09:00
parent cb7b04a56e
commit 8cb610e262

View File

@@ -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();
}