Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LibWeb/CSS: Populate 'cached_x_samples' properly in 'CubicBezier::evaluate_at' #3676

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mobounya
Copy link
Contributor

When we populate 'm_cached_x_samples' the last value might be less than 1.0, which leads to a crash when 'input_progress == 1' since the binary search populate 'nearby_index' with the index of the last element in 'm_cached_x_samples' and when we try to linearly interpolate between 'm_cached_x_samples[nearby_index]' and m_cached_x_samples[nearby_index + 2] we crash because of an index out of bounds assertion failure.

This change makes sure the loop responsible for populating 'm_cached_x_samples' reaches 'input_progress'.

This fixes the issue described in #3628

@mobounya mobounya requested a review from AtkinsSJ as a code owner February 23, 2025 18:08
@ladybird-bot
Copy link
Collaborator

Hello!

One or more of the commit messages in this PR do not match the Ladybird code submission policy, please check the lint_commits CI job for more details on which commits were flagged and why.
Please do not close this PR and open another, instead modify your commit message(s) with git commit --amend and force push those changes to update this PR.

When we populate 'm_cached_x_samples' the last value might
be less than 1.0, which leads to a crash when 'input_progress == 1'
since the binary search populate 'nearby_index' with the index of the
last element in 'm_cached_x_samples' and when we try to linearly
interpolate between 'm_cached_x_samples[nearby_index]' and
m_cached_x_samples[nearby_index + 2] we crash because of an index out
of bounds assertion failure.

This change makes sure the loop responsible for populating
'm_cached_x_samples' reaches 'input_progress'.
@mobounya mobounya force-pushed the fix-cubic-bezier-evaluate-at branch from 32f3821 to 93468cc Compare February 23, 2025 18:11
@gmta
Copy link
Collaborator

gmta commented Feb 23, 2025

Hi! Could you add a test exposing the issue you've fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants