1/* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * SPDX-License-Identifier: GPL-2.0 4 * 5 * Unless required by applicable law or agreed to in writing, software 6 * distributed under the License is distributed on an "AS IS" BASIS, 7 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 8 * See the License for the specific language governing permissions and 9 * limitations under the License. 10 reinterpret_cast 11 static_cast 12 */ 13 14#include <vector> 15#include <cstddef> 16#include <cstdint> 17#include "__config" 18#include "accesstokenidcommon.h" 19 20using namespace std; 21using namespace OHOS::Kernel::AccessToken; 22namespace OHOS { 23bool GetTokenidNullptrFuzzTest(const uint8_t *data, size_t size) 24{ 25 bool ret = false; 26 if (data == nullptr) { 27 unsigned long long tokenId = *(reinterpret_cast<const unsigned long long *>(data)); 28 ret = GetTokenid(&tokenId); 29 } else { 30 return ret; 31 } 32 return ret; 33} 34} 35 36extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) 37{ 38 OHOS::GetTokenidNullptrFuzzTest(data, size); 39 return 0; 40} 41