Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(471)

Unified Diff: media/filters/vpx_video_decoder_fuzzertest.cc

Issue 2324843004: Generate more valid configurations in media_vpx_video_decoder_fuzzer. (Closed)
Patch Set: Rebase + change the description. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/vpx_video_decoder_fuzzertest.cc
diff --git a/media/filters/vpx_video_decoder_fuzzertest.cc b/media/filters/vpx_video_decoder_fuzzertest.cc
index f2d1e79a1b9783c141c38af5d36d03c6e9e56970..15eefda4da5b65ab58d9e2abd84fd368adc20852 100644
--- a/media/filters/vpx_video_decoder_fuzzertest.cc
+++ b/media/filters/vpx_video_decoder_fuzzertest.cc
@@ -55,19 +55,44 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
// Compute randomized constants. Put all rng() usages here.
- auto codec = static_cast<VideoCodec>(rng() % kVideoCodecMax);
+ // Use only values that pass DCHECK in VpxVideoDecoder::ConfigureDecoder().
+ VideoCodec codec;
+ VideoPixelFormat pixel_format;
+ if (rng() & 1) {
+ codec = kCodecVP8;
+ // PIXEL_FORMAT_YV12 disabled for kCodecVP8 on Linux.
+ pixel_format = PIXEL_FORMAT_YV12A;
+ } else {
+ codec = kCodecVP9;
+ switch (rng() % 3) {
+ case 0:
+ pixel_format = PIXEL_FORMAT_YV12;
+ break;
+ case 1:
+ pixel_format = PIXEL_FORMAT_YV12A;
+ break;
+ case 2:
+ pixel_format = PIXEL_FORMAT_YV24;
+ break;
+ default:
+ return 0;
+ }
+ }
+
auto profile =
static_cast<VideoCodecProfile>(rng() % VIDEO_CODEC_PROFILE_MAX);
- auto pixel_format = static_cast<VideoPixelFormat>(rng() % PIXEL_FORMAT_MAX);
auto color_space = static_cast<ColorSpace>(rng() % COLOR_SPACE_MAX);
- auto coded_size = gfx::Size(rng() % 128, rng() % 128);
- auto visible_rect = gfx::Rect(rng() % 128, rng() % 128);
- auto natural_size = gfx::Size(rng() % 128, rng() % 128);
+ auto coded_size = gfx::Size(1 + (rng() % 127), 1 + (rng() % 127));
+ auto visible_rect = gfx::Rect(coded_size);
+ auto natural_size = gfx::Size(1 + (rng() % 127), 1 + (rng() % 127));
VideoDecoderConfig config(codec, profile, pixel_format, color_space,
coded_size, visible_rect, natural_size,
EmptyExtraData(), Unencrypted());
+ if (!config.IsValidConfig())
+ return 0;
+
VpxVideoDecoder decoder;
{
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698