unichronic
107825b609
demux: mkv: fix NULL deference error with invalid header compression
6 months ago
cs-308-2023
375e8cdcf4
mkv: fix leak of ancilliary data
6 months ago
Alexandre Janniaux
ee8620572a
demux: mkv: dereference optional before passing debug()
Variadics might not know about std::optional<> since it triggers C code
and it might be undefined depending on the representation of optional<>.
Since we set the std::optional<> right before, ensure it returns the
wrapped value.
6 months ago
Steve Lhomme
1ffcd7d86b
demux: mkv: fix default language leak
Regression from 686d636a9e
6 months ago
Steve Lhomme
37e0097a47
demux: mkv: only set the video.pose if the track won't be discarded
6 months ago
Steve Lhomme
ec79f5fce5
demux: mkv: check the language string is a valid ISO639 one
Even the IETF base languages is using ISO639.
6 months ago
Steve Lhomme
686d636a9e
demux: mkv: handle the IETF language with more priority than the old language element
See [^1].
[^1]: https://www.rfc-editor.org/rfc/rfc9559#language-codes
6 months ago
Steve Lhomme
e99cddb6e7
demux: mkv: use "eng" as the default language.
For each track the language element needs to be present of the default value is "eng" [^1].
[^1]: https://www.rfc-editor.org/rfc/rfc9559#section-5.1.4.1.19
6 months ago
Steve Lhomme
36decaa0b3
demux: mkv: add support for VVC
Fixes #29584
6 months ago
Mathias APARICIO
2df6bca67b
demux: mkv: Prevent leak in ParseTrackEntry
Oss-fuzz 4605658287898624 highlights a memory leak in the
KaxCompSettings handler.
Delete the pointer vars.tk->p_compression_data before allocating again
so it is not overwritten.
Address https://code.videolan.org/videolan/vlc/-/issues/29561
7 months ago
Mathias APARICIO
4219757a3c
demux: mkv: fix stack overflow in script interpreter
OSS-Fuzz 4838250396319744 identified a stack overflow in the Interpret
function (looping between frames 3 and 12).
This patch introduces a recursion depth check M_MS_MAX_DEPTH 8 (the matroska specification lists 7 chapter layers in the menu https://www.matroska.org/technical/chapter_codecs.html#:~:text=DVD%20menu ) to
prevent stack exhaustion.
The counter is static thread_local so that the value is not discarded after return and is not mutated by other threads.
Tackles videolan/vlc#29553
7 months ago
Steve Lhomme
e2c579c7df
demux: mkv: only interpret the command has a value to interpret
7 months ago
Steve Lhomme
b63629f2ae
demux: mkv: discard GotoAndPlay command if there's extra text before the parenthesis
- GotoAndPlay() is supported
- GotoAndPlay () is supported
- GotoAndPlay abc() is not supported
Ref. #29553
7 months ago
Steve Lhomme
e32aac7836
demux: mkv: avoid infinite loop on entering a chapter with GotoAndPlay(<itself>)
7 months ago
Steve Lhomme
ccc1774257
demux: mkv: pass the MatroskaChapterProcessTime to the command interpreter
We may want to know when the chapter is entering/leaving with the command.
7 months ago
Steve Lhomme
dd71c902f3
demux: mkv: fix string to chapter_uid conversion
The integer can use the whole uint64_t range.
std::stoul() will generate a std::out_of_range exception on values larger than a uint32_t.
Ref. #29553
7 months ago
Steve Lhomme
36d591a3e9
demux: mkv: fix leak on multiple string definition
These elements are all supposed to be unique. But as we always kept the last
value, we continue to do so without leaking the previous value.
Fixes #29521
7 months ago
Steve Lhomme
39cde5970d
demux: mkv: don't keep the segment original file name
It's not used and not reliable.
7 months ago
Steve Lhomme
693f19eda6
demux: mkv: don't keep the segment string date
The value is only turned into a string for logging.
If we want to keep the date we just use the integer value.
7 months ago
Steve Lhomme
99df59ea4f
demux: mkv: split helpers to get UTF8 without a copy
7 months ago
Steve Lhomme
804bb1183d
demux: mkv: avoid leaking elements we overwrite
Unless they are marked as for keeps.
Fixes #29519
7 months ago
Steve Lhomme
d51fc15b96
demux: mkv: fix PrivateTrackData not checking errors properly
Cook_PrivateTrackData::Init() was always returning the same value on error or success.
Bug introduced in 7cac9cbe05 .
Fixes #29523
7 months ago
Steve Lhomme
c55b595dcc
demux: mkv: fix potential input buffer overrun
Ref. #29516 which I can't reproduce but seems to point there.
7 months ago
Steve Lhomme
8af818eca9
demux: mkv: add support for LZO1X decompression via lzokay
lzokay [^1] is a C++ MIT-licensed library to (de)compress LZO1X.
[^1]: https://github.com/AxioDL/lzokay
8 months ago
Steve Lhomme
5ea45b5287
demux: mkv: use VLC-like 16-bit little endian reader for lzo1x
In C++20 we could use std::endian [^1].
[^1]: https://en.cppreference.com/w/cpp/types/endian.html
8 months ago
Steve Lhomme
1736cc96f7
demux: mkv: use standard way to get size_t maximum for lzo1x
8 months ago
Steve Lhomme
4e82b1e8d0
demux: mkv: remove unused lzo1x compression code
8 months ago
Steve Lhomme
235c0fef76
demux: mkv: add LZO1X decompression code from lzokay
lzokay [^1] is a C++ MIT-licensed library to (de)compress LZO1X.
[^1]: https://github.com/AxioDL/lzokay
8 months ago
Steve Lhomme
2c38b23ccd
demux: mkv: fix potential division by zero
Fixes https://code.videolan.org/videolan/vlc/-/issues/29444
9 months ago
Steve Lhomme
8f5fc2c2f1
demux: mkv: fix frame leak on Block read error
Fixes #29449
9 months ago
Steve Lhomme
c9af0b78af
demux: mkv: use safer cast to Cook_PrivateTrackData
10 months ago
Steve Lhomme
49eaa39aac
demux: mkv: use a C++ vector for the RealAudio sub packets
This is less error-prone.
10 months ago
Steve Lhomme
216e30ef43
demux: mkv: use the coded_frame_size for RA288 block alignment
As done in libavformat.
10 months ago
Steve Lhomme
04f5babb91
demux: mkv: move the RealAudio structures in util.cpp
10 months ago
Steve Lhomme
7cac9cbe05
demux: mkv: parse RealAudio extradata directly in Cook_PrivateTrackData
Using a byte reader to avoid relying on unpacked structures.
Fixes #29420
10 months ago
Steve Lhomme
547448a0d1
demux: mkv: add a simple byte reader class
Faster than bs_t for bytes and can handle little/big-endian.
10 months ago
Steve Lhomme
b714e22d6b
demux: mkv: read the cook/atrac3 blockalign in A_REAL__helper
So that the real_audio_private handling is handled in one location.
10 months ago
Steve Lhomme
7af48e2945
demux: mkv: check the real_audio_private size based on packed size
10 months ago
Steve Lhomme
80fae6dbb2
demux: mkv: pass VLC_CODEC_xxx as vlc_fourcc_t
10 months ago
Steve Lhomme
b01b944250
demux: mkv: only send actual blocks
If i_sub_packet_h/i_sub_packet_h/i_subpacket_size have odd values,
the index may of filled blocks may not cover all the arrays.
We send the blocks that are at the proper place in hope the decoder
can make something of it.
Fixes https://hackerone.com/reports/491495
10 months ago
Steve Lhomme
f9500c2367
Revert "demux:mkv: fix wrong value reset after clean of an array"
This reverts commit d1d41b3f84 .
The i_subpackets value represents the size of the p_subpackets array.
It should not change during the lifetime of that array.
The i_subpacket value is the count of actually filled elements in the array.
When the array is fully loaded we can send the blocks for decoding.
The fix for the hacker one file should be different.
10 months ago
Steve Lhomme
520ccf8912
demux: mkv: move local updated range into ranges
11 months ago
Steve Lhomme
ed4a4b30b9
demux: mkv: move local classes into tags containers
11 months ago
Steve Lhomme
e323603c61
demux: mkv: avoid leaking KaxChapterTranslateID on overwriting
11 months ago
Steve Lhomme
59f5eb9acc
demux: mkv: avoid leaking string on overwriting
11 months ago
Steve Lhomme
40c025729e
demux: mkv: avoid leaking block on error
11 months ago
Steve Lhomme
d90a850486
demux: mkv: on keep chapter valid chapter_translation_c
11 months ago
Steve Lhomme
86200a59f6
demux: mkv: add a way to validate a chapter_translation_c
11 months ago
Steve Lhomme
5bdb5a5904
demux: mkv: fix uncaught throw when reading Block data
11 months ago
Steve Lhomme
6c5297b7db
demux: mkv: fix uncaught throw when reading Cluster first elements
Fixes https://code.videolan.org/videolan/vlc/-/issues/29288
11 months ago