diff --git a/fs_mgr/liblp/fuzzer/liblp_apis_fuzzer.cpp b/fs_mgr/liblp/fuzzer/liblp_apis_fuzzer.cpp index b6fbc142a..a15bc8905 100644 --- a/fs_mgr/liblp/fuzzer/liblp_apis_fuzzer.cpp +++ b/fs_mgr/liblp/fuzzer/liblp_apis_fuzzer.cpp @@ -198,13 +198,13 @@ void LiplpApisFuzzer::process() { [&]() { uint32_t groupVectorSize = metadata->groups.size(); uint32_t randomGroupIndex = - mFdp.ConsumeIntegralInRange(0, groupVectorSize); + mFdp.ConsumeIntegralInRange(0, groupVectorSize - 1); GetPartitionGroupName(metadata->groups[randomGroupIndex]); }, [&]() { uint32_t blockDeviceVectorSize = metadata->block_devices.size(); uint32_t randomBlockDeviceIndex = - mFdp.ConsumeIntegralInRange(0, blockDeviceVectorSize); + mFdp.ConsumeIntegralInRange(0, blockDeviceVectorSize - 1); GetBlockDevicePartitionName( metadata->block_devices[randomBlockDeviceIndex]); }, @@ -224,7 +224,7 @@ void LiplpApisFuzzer::process() { [&]() { uint32_t partitionVectorSize = metadata->partitions.size(); uint32_t randomPartitionIndex = - mFdp.ConsumeIntegralInRange(0, partitionVectorSize); + mFdp.ConsumeIntegralInRange(0, partitionVectorSize - 1); GetPartitionName(metadata->partitions[randomPartitionIndex]); }, [&]() { GetTotalSuperPartitionSize(metadataValue); },