Skip to content

Commit dcf4253

Browse files
committed
vpx_enc_fuzzer: limit number of encoded frames
Previously the encode loop was only bounded by the data size. With the small resolutions being fuzzed this might result in hundreds of thousands of frames to encode, resulting in a timeout. The frames are now limited to 300. Bug: 482163265, 482328006, 482494306, 482594458 Change-Id: I026de66933a267e1ce7e979005eea181bfd54a1e
1 parent a0ac06f commit dcf4253

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

examples/vpx_enc_fuzzer.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@
8080
#define VPXC_INTERFACE(name) VPXC_INTERFACE_(name)
8181
#define VPXC_INTERFACE_(name) vpx_codec_##name##_cx()
8282

83+
static constexpr int kMaxFrames = 300;
84+
8385
extern "C" void usage_exit(void) { exit(EXIT_FAILURE); }
8486

8587
static int vpx_img_plane_width(const vpx_image_t *img, int plane) {
@@ -230,7 +232,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
230232
size -= FUZZ_HDR_SZ;
231233

232234
// Encode frames.
233-
while (1) {
235+
for (int i = 0; i < kMaxFrames; ++i) {
234236
int flags = 0;
235237
size_t size_read = fuzz_vpx_img_read(&raw, data, size);
236238
if (size_read == 0) break;

0 commit comments

Comments
 (0)