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

Unified Diff: media/filters/vpx_video_decoder_fuzzertest.cc

Issue 2324843004: Generate more valid configurations in media_vpx_video_decoder_fuzzer. (Closed)
Patch Set: Created 4 years, 3 months 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 f22040bcb8b55c84c7b6a83cd39102e9190d5e5d..1007a74626b2829fc101ea470eda5a3aae560391 100644
--- a/media/filters/vpx_video_decoder_fuzzertest.cc
+++ b/media/filters/vpx_video_decoder_fuzzertest.cc
@@ -44,10 +44,36 @@ 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;
+ if (rng() & 1) {
+ // PIXEL_FORMAT_YV12 disabled if !defined(DISABLE_FFMPEG_VIDEO_DECODERS).
jrummell 2016/09/09 17:33:00 I wouldn't worry about this case. DISABLE_FFMPEG_V
mmoroz 2016/09/15 17:56:02 Hmmm, it quickly crashes on Linux if I use PIXEL_F
+ pixel_format = PIXEL_FORMAT_YV12A;
+ } else {
+ pixel_format = PIXEL_FORMAT_YV12A;
jrummell 2016/09/09 17:33:00 This is the same format. Did you mean YV12 for one
mmoroz 2016/09/15 17:56:01 I left it here to discuss the point we've discusse
+ }
+ } else {
+ codec = kCodecVP9;
+ switch (rng() % 3) {
+ case 0:
+ pixel_format = PIXEL_FORMAT_YV12;
jrummell 2016/09/09 17:33:00 Since this is a common format, I would make this c
mmoroz 2016/09/15 17:56:02 It doesn't work with kCodecVP8, crashes pretty qui
+ 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);
jrummell 2016/09/09 17:33:00 width and height must be > 0, so use (rng() % 127)
mmoroz 2016/09/15 17:56:01 Done.
auto visible_rect = gfx::Rect(rng() % 128, rng() % 128);
jrummell 2016/09/09 17:33:00 Since visible_rect <= coded_size, I would just mak
mmoroz 2016/09/15 17:56:01 Done.
@@ -57,6 +83,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
coded_size, visible_rect, natural_size,
EmptyExtraData(), Unencrypted());
+ if (!config.IsValidConfig())
+ return 0;
+
VpxVideoDecoder decoder;
base::RunLoop run_loop;
@@ -66,7 +95,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
auto buffer = DecoderBuffer::CopyFrom(data, size);
decoder.Decode(buffer, base::Bind(&OnDecodeComplete));
jrummell 2016/09/09 17:33:00 Decode() has a DCHECK to make sure Initialize pass
mmoroz 2016/09/15 17:56:02 Actually, the restrictions implemented above provi
- run_loop.RunUntilIdle();
+ // Otherwise crashes on DCHECK in RunLoop::BeforeRun().
+ run_loop.QuitWhenIdle();
return 0;
}
« 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