FUZZ告警清理

Signed-off-by: lixiyuan <lixiyuan7@huawei.com>
This commit is contained in:
lixiyuan 2024-11-21 15:03:51 +08:00
parent 4d4f876d04
commit 0fdb9b17e8
3 changed files with 31 additions and 2 deletions

View File

@ -18,11 +18,22 @@
#include <cstdint>
namespace OHOS {
template<typename T>
T TypeCast(const uint8_t *data, int *pos)
{
if (pos) {
*pos += sizeof(T);
}
return *(reinterpret_cast<const T*>(data));
}
bool FileUtilFuzzTest(const uint8_t *data, size_t size)
{
if ((data == nullptr) || (size == 0)) {
return false;
if ((data == nullptr) || (size <sizeof(uint64_t) * 6)) {
return true;
}
int64_t total = TypeCast<int64_t>(data, nullptr);
Parcel parcel;
StorageManager::BundleStats bundlestats;
bundlestats.Marshalling(parcel);

View File

@ -18,6 +18,15 @@
#include <cstdint>
namespace OHOS {
template<typename T>
T TypeCast(const uint8_t *data, int *pos)
{
if (pos) {
*pos += sizeof(T);
}
return *(reinterpret_cast<const T*>(data));
}
bool FileUtilFuzzTest(const uint8_t *data, size_t size)
{
if ((data == nullptr) || (size == 0)) {

View File

@ -18,6 +18,15 @@
#include "storage_service_errno.h"
namespace OHOS {
namespace StorageManager {
template<typename T>
T TypeCast(const uint8_t *data, int *pos)
{
if (pos) {
*pos += sizeof(T);
}
return *(reinterpret_cast<const T*>(data));
}
bool StorageTotalStatusServiceFuzzTest(const uint8_t *data, size_t size)
{
if ((data == nullptr) || (size == 0)) {