blob: 9dc08fb6e7fbb08cade57b4526a3b8ae1abd0de7 [file] [log] [blame]
// Copyright 2021 Google LLC
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.
#include "dice/cbor_reader.h"
#include "fuzzer/FuzzedDataProvider.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
int64_t signed_int;
uint64_t unsigned_int;
size_t sz;
const uint8_t* ptr;
const char* str;
CborIn in;
CborIn peeker;
CborInInit(data, size, &in);
do {
peeker = in;
CborReadInt(&peeker, &signed_int);
peeker = in;
CborReadUint(&peeker, &unsigned_int);
peeker = in;
CborReadBstr(&peeker, &sz, &ptr);
peeker = in;
CborReadTstr(&peeker, &sz, &str);
peeker = in;
CborReadArray(&peeker, &sz);
peeker = in;
CborReadMap(&peeker, &sz);
peeker = in;
peeker = in;
peeker = in;
if (CborReadSkip(&in) != CBOR_READ_RESULT_OK) {
// Cannot progress futher with this buffer.
} while (!CborInAtEnd(&in));
return 0;