• 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/base/resource/resource_scale_factor.h"
10 #include "ui/gfx/image/image.h"
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 // Entry point for LibFuzzer.
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)22 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
23   ui::SetSupportedResourceScaleFactors({ui::k100Percent});
24   gfx::Image image = gfx::Image::CreateFrom1xPNGBytes(data, size);
25   if (image.IsEmpty()) {
26     return 0;
27   }
28 
29   image.ToSkBitmap();
30   return 0;
31 }
32