!16833 add testcase

Merge pull request !16833 from lishijie/fuzz1105
This commit is contained in:
openharmony_ci 2024-11-06 10:27:22 +00:00 committed by Gitee
commit 63c0c36b4a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 52 additions and 2 deletions

View File

@ -18,7 +18,7 @@
<!-- maximum length of a test input -->
<max_len>1000</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>300</max_total_time>
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>4096</rss_limit_mb>
</fuzztest>

View File

@ -223,6 +223,8 @@ bool DoOnBoundsSizeChanged(const uint8_t* data, size_t size)
delete RSTransactionProxy::instance_;
RSTransactionProxy::instance_ = nullptr;
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create(isRenderServiceNode, isTextureExportNode);
BoundsChangedCallback callback = [](const Rosen::Vector4f& vector4f) {};
canvasNode->SetBoundsChangedCallback(callback);
canvasNode->OnBoundsSizeChanged();
return true;
}
@ -248,6 +250,53 @@ bool DoSetBoundsChangedCallback(const uint8_t* data, size_t size)
canvasNode->SetBoundsChangedCallback(callback);
return true;
}
bool DoDrawOnNode002(const uint8_t* data, size_t size)
{
if (data == nullptr) {
return false;
}
// initialize
DATA = data;
g_size = size;
g_pos = 0;
// test
bool isRenderServiceNode = GetData<bool>();
bool isTextureExportNode = GetData<bool>();
int width = GetData<int>();
int height = GetData<int>();
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create(isRenderServiceNode, isTextureExportNode);
RSModifierType type = RSModifierType::BOUNDS;
DrawFunc func = [&](std::shared_ptr<Drawing::Canvas>) {};
RSCanvasNode rsCanvasNode(isRenderServiceNode, isTextureExportNode);
rsCanvasNode.DrawOnNode(type, func);
rsCanvasNode.BeginRecording(width, height);
rsCanvasNode.IsRecording();
rsCanvasNode.FinishRecording();
return true;
}
bool DoSetFreeze002(const uint8_t* data, size_t size)
{
if (data == nullptr) {
return false;
}
// initialize
DATA = data;
g_size = size;
g_pos = 0;
// test
bool isRenderServiceNode = GetData<bool>();
bool isTextureExportNode = GetData<bool>();
RSCanvasNode::SharedPtr canvasNode = RSCanvasNode::Create(isRenderServiceNode, isTextureExportNode);
bool isFreeze = GetData<bool>();
canvasNode->SetFreeze(isFreeze);
return true;
}
} // namespace Rosen
} // namespace OHOS
@ -264,6 +313,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
OHOS::Rosen::DoSetHDRPresent(data, size);
OHOS::Rosen::DoOnBoundsSizeChanged(data, size);
OHOS::Rosen::DoSetBoundsChangedCallback(data, size);
OHOS::Rosen::DoDrawOnNode002(data, size);
OHOS::Rosen::DoSetFreeze002(data, size);
return 0;
}