LibMedia: Clamp Matroska cluster timestamps when casting them

This commit is contained in:
Zaggy1024 2025-10-21 15:06:14 -05:00 committed by Jelle Raaijmakers
parent f899d49e18
commit dcc2359eac
Notes: github-actions[bot] 2025-11-21 10:04:09 +00:00

View file

@ -616,7 +616,7 @@ static DecoderErrorOr<Cluster> parse_cluster(Streamer& streamer, u64 timestamp_s
TRY_READ(streamer.seek_to_position(first_element_position));
Cluster cluster;
cluster.set_timestamp(AK::Duration::from_nanoseconds(timestamp.release_value() * timestamp_scale));
cluster.set_timestamp(AK::Duration::from_nanoseconds(AK::clamp_to<i64>(timestamp.release_value() * timestamp_scale)));
return cluster;
}