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