Skip to content

Commit db1d7eb

Browse files
panayotovmarkochemag
authored andcommitted
isobmff: add fuzzing to STTS atom parser
1 parent ae78d09 commit db1d7eb

9 files changed

Lines changed: 31 additions & 1 deletion

fuzz/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ CONVERTER = ./converter.py
66
RUNS ?= 100
77

88
# List of fuzzers
9-
FUZZERS = Parser META FTYP MVHD HDLR TKHD MDHD DREF STSD HVC1 HVCC
9+
FUZZERS = Parser META FTYP MVHD HDLR TKHD MDHD DREF STSD HVC1 HVCC STTS
1010

1111
# Default target
1212
all: $(addsuffix _fuzzer.cpp, $(FUZZERS))

fuzz/STTS_fuzzer.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and its affiliates.
3+
*/
4+
5+
// This file was auto-generated using fuzz/converter.py from
6+
// STTS_unittest.cpp.
7+
// Do not edit directly.
8+
9+
#include <ISOBMFF.hpp> // for various
10+
#include <BinaryDataStream.hpp> // for BinaryDataStream
11+
#include <Parser.hpp> // for Parser
12+
13+
14+
// libfuzzer infra to test the fuzz target
15+
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
16+
const std::vector<uint8_t> buffer_vector = {data, data + size};
17+
{
18+
ISOBMFF::BinaryDataStream stream(buffer_vector);
19+
ISOBMFF::Parser parser;
20+
std::shared_ptr<ISOBMFF::Box> box = parser.CreateBox("stts");
21+
try {
22+
if (box != nullptr) {
23+
box->ReadData(parser, stream);
24+
}
25+
} catch (std::exception &e) {
26+
fprintf(stderr, "Caught exception: %s\n", e.what());
27+
}
28+
}
29+
return 0;
30+
}
22 Bytes
Binary file not shown.
74 Bytes
Binary file not shown.
15 Bytes
Binary file not shown.
20 Bytes
Binary file not shown.
21 Bytes
Binary file not shown.
21 Bytes
Binary file not shown.
88 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)