mirror of
https://gitee.com/openharmony/developtools_hiperf
synced 2024-11-23 15:39:47 +00:00
!98 fix PerfFile_fuzzer test failed issue
Merge pull request !98 from wenlong_12/master
This commit is contained in:
commit
d448b70c59
@ -14,6 +14,7 @@
|
||||
*/
|
||||
|
||||
#include "PerfFile_fuzzer.h"
|
||||
#include "utilities.h"
|
||||
|
||||
namespace OHOS {
|
||||
using namespace OHOS::Developtools::HiPerf;
|
||||
@ -63,18 +64,15 @@ public:
|
||||
static std::unique_ptr<PerfFileReaderFuzzer> Instance(const std::string &fileName,
|
||||
const uint8_t *data, size_t size)
|
||||
{
|
||||
FILE *fp_ = fopen(fileName.c_str(), "rb");
|
||||
if (fp_ == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
std::unique_ptr<FILE, decltype(&fclose)> fp(fp_, fclose);
|
||||
std::string resolvedPath = CanonicalizeSpecPath(fileName.c_str());
|
||||
FILE *fp = fopen(resolvedPath.c_str(), "rb");
|
||||
if (fp == nullptr) {
|
||||
HLOGE("fail to open file %s", fileName.c_str());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<PerfFileReaderFuzzer> reader =
|
||||
std::make_unique<PerfFileReaderFuzzer>(fileName, fp.get());
|
||||
std::make_unique<PerfFileReaderFuzzer>(resolvedPath, fp);
|
||||
|
||||
reader->dataPtr_ = reinterpret_cast<const char *>(data);
|
||||
reader->dataSize_ = size;
|
||||
|
Loading…
Reference in New Issue
Block a user