• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include <stddef.h>
6 #include <stdint.h>
7 #include <string.h>
8 
9 #include "zlib.h"
10 
11 static Bytef buffer[256 * 1024] = { 0 };
12 
13 // Entry point for LibFuzzer.
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)14 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
15   uLongf buffer_length = static_cast<uLongf>(sizeof(buffer));
16   if (Z_OK != uncompress(buffer, &buffer_length, data,
17                          static_cast<uLong>(size))) {
18     return 0;
19   }
20   return 0;
21 }
22