1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38:12 +00:00
serenity/Meta/Lagom/Fuzzers/FuzzMatroskaReader.cpp
Zaggy1024 393cfdd5c5 LibVideo: Read Matroska lazily so that large files can start quickly
The Demuxer class was changed to return errors for more functions so
that all of the underlying reading can be done lazily. Other than that,
the demuxer interface is unchanged, and only the underlying reader was
modified.

The MatroskaDocument class is no more, and MatroskaReader's getter
functions replace it. Every MatroskaReader getter beyond the Segment
element's position is parsed lazily from the file as needed. This means
that all getter functions can return DecoderErrors which must be
handled by callers.
2022-11-25 23:28:39 +01:00

20 lines
625 B
C++

/*
* Copyright (c) 2022, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibVideo/Containers/Matroska/Reader.h>
#include <stddef.h>
extern "C" int LLVMFuzzerTestOneInput(u8 const* data, size_t size)
{
auto matroska_reader_result = Video::Matroska::Reader::from_data({ data, size });
if (matroska_reader_result.is_error())
return -1;
if (auto result = matroska_reader_result.value().segment_information(); result.is_error())
return -1;
if (auto result = matroska_reader_result.value().track_count(); result.is_error())
return -1;
return 0;
}