1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:37:35 +00:00

Ladybird+LibWeb+WebContent: Prevent out-of-bounds seeking audio elements

It's currently possible to seek to the total sample count of an audio
loader. We must limit seeking to one less than that count.

This mistake was duplicated in both AudioCodecPluginSerenity/Ladybird,
so the computation was moved to a helper in the base AudioCodecPlugin.
This commit is contained in:
Timothy Flynn 2023-06-21 19:37:10 -04:00 committed by Andreas Kling
parent 20edbb70f8
commit bcd222cfae
4 changed files with 17 additions and 16 deletions

View file

@ -24,6 +24,7 @@ public:
virtual ~AudioCodecPlugin();
static ErrorOr<FixedArray<Audio::Sample>> read_samples_from_loader(Audio::Loader&, size_t samples_to_load, size_t device_sample_rate);
static Duration set_loader_position(Audio::Loader&, double position, Duration duration, size_t device_sample_rate);
static Duration current_loader_position(Audio::Loader const&, size_t device_sample_rate);
virtual void resume_playback() = 0;