chromium/ui/gfx/codec/BUILD.gn

# Copyright 2017 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/features.gni")
import("//build/config/ui.gni")
import("//testing/libfuzzer/fuzzer_test.gni")

component("codec") {
  sources = [
    "codec_export.h",
    "jpeg_codec.cc",
    "jpeg_codec.h",
    "png_codec.cc",
    "png_codec.h",
    "vector_wstream.cc",
    "vector_wstream.h",
    "webp_codec.cc",
    "webp_codec.h",
  ]

  deps = [
    "//base",
    "//skia",
    "//third_party/zlib",
    "//ui/gfx:gfx_export",
    "//ui/gfx:gfx_skia",
    "//ui/gfx/geometry",
  ]

  if (!use_blink) {
    sources -= [
      "jpeg_codec.cc",
      "jpeg_codec.h",
    ]
  }

  if (is_win) {
    cflags = [ "/wd4324" ]  # Structure was padded due to __declspec(align()),
                            # which is uninteresting.
  }

  defines = [ "CODEC_IMPLEMENTATION" ]
}

fuzzer_test("gfx_jpeg_decoder_fuzzer") {
  sources = [ "jpeg_decoder_fuzzer.cc" ]
  deps = [
    ":codec",
    "//skia",
  ]
  seed_corpuses = [ "//third_party/blink/web_tests/images/resources/jpegfuzz" ]
  libfuzzer_options = [ "rss_limit_mb=8192" ]
}

fuzzer_test("gfx_png_decoder_fuzzer") {
  sources = [ "png_decoder_fuzzer.cc" ]
  deps = [
    ":codec",
    "//skia",
  ]
  seed_corpuses = [ "//third_party/blink/web_tests/images/resources/pngfuzz" ]
  libfuzzer_options = [ "rss_limit_mb=8192" ]
}