diff --git a/test/fuzztest/fileaccessservicebaseproxy_fuzzer/fileaccessservicebaseproxy_fuzzer.cpp b/test/fuzztest/fileaccessservicebaseproxy_fuzzer/fileaccessservicebaseproxy_fuzzer.cpp index 962422561cf14766cd8d33cc476159bf02e60744..e00bfcdf8181c8823ce34a4f9f0563bdefbeadbf 100644 --- a/test/fuzztest/fileaccessservicebaseproxy_fuzzer/fileaccessservicebaseproxy_fuzzer.cpp +++ b/test/fuzztest/fileaccessservicebaseproxy_fuzzer/fileaccessservicebaseproxy_fuzzer.cpp @@ -168,7 +168,7 @@ bool ConnectFileExtAbilityFuzzTest(sptr proxy, const uin bool UnregisterNotifyNoObserverFuzzTest(sptr proxy, const uint8_t* data, size_t size) { - if (data == nullptr || size < sizeof(bool)) { + if (data == nullptr || size < sizeof(bool) || g_fah == nullptr) { return true; } @@ -176,7 +176,7 @@ bool UnregisterNotifyNoObserverFuzzTest(sptr proxy, cons Uri uri(string(reinterpret_cast(data + pos), size - pos)); AAFwk::Want want; want.SetElementName(EXTERNAL_BNUDLE_NAME, "FileExtensionAbility"); - std::shared_ptr info = std::make_shared(want, g_fah->token_); + sptr info = sptr(new (std::nothrow) ConnectExtensionInfo(want, g_fah->token_)); proxy->UnregisterNotifyNoObserver(uri, *info); return true; }