2022-10-12 00:44:06 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2022, the SerenityOS developers.
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
2024-06-10 17:04:03 -03:00
|
|
|
#include <LibMedia/Containers/Matroska/Reader.h>
|
2026-01-28 20:35:33 -03:00
|
|
|
#include <LibMedia/IncrementallyPopulatedStream.h>
|
2022-10-12 00:44:06 -03:00
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
|
|
extern "C" int LLVMFuzzerTestOneInput(u8 const* data, size_t size)
|
|
|
|
|
{
|
2023-11-03 14:49:54 -03:00
|
|
|
AK::set_debug_enabled(false);
|
2026-06-08 11:04:14 -03:00
|
|
|
|
|
|
|
|
auto stream = Media::IncrementallyPopulatedStream::create_empty();
|
|
|
|
|
if (size > 0)
|
|
|
|
|
stream->add_chunk_at(0, { data, size });
|
|
|
|
|
stream->close();
|
|
|
|
|
|
2025-12-12 09:15:14 -03:00
|
|
|
auto matroska_reader_result = Media::Matroska::Reader::from_stream(stream->create_cursor());
|
2022-11-11 20:14:27 -03:00
|
|
|
if (matroska_reader_result.is_error())
|
2022-12-04 22:08:04 -03:00
|
|
|
return 0;
|
2026-01-05 21:03:22 -03:00
|
|
|
(void)matroska_reader_result.value().duration();
|
2022-12-04 22:08:04 -03:00
|
|
|
(void)matroska_reader_result.value().track_count();
|
2022-10-12 00:44:06 -03:00
|
|
|
return 0;
|
|
|
|
|
}
|