• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2015 The Chromium Authors
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 
8 #include "base/logging.h"
9 #include "ui/gfx/image/image.h"
10 
11 
12 struct Environment {
EnvironmentEnvironment13   Environment() {
14     // Disable noisy logging.
15     logging::SetMinLogLevel(logging::LOG_FATAL);
16   }
17 };
18 
19 Environment* env = new Environment();
20 
21 
22 // Entry point for LibFuzzer.
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)23 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
24   gfx::Image image = gfx::Image::CreateFrom1xPNGBytes(data, size);
25 
26   if (image.IsEmpty())
27     return 0;
28 
29   image.ToSkBitmap();
30 
31   return 0;
32 }
33