mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-07 10:06:03 +00:00
LibWeb: Prevent overrunning loop bounds in cubic bezier calculation
This commit is contained in:
parent
31618abf15
commit
7f902fa2dc
Notes:
sideshowbarker
2024-07-17 05:01:20 +09:00
Author: https://github.com/mattco98
Commit: 7f902fa2dc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/106
1 changed files with 3 additions and 3 deletions
|
@ -95,9 +95,9 @@ double CubicBezierTimingFunction::operator()(double input_progress, bool) const
|
||||||
|
|
||||||
if (nearby_index == m_cached_x_samples.size() || nearby_index + 1 == m_cached_x_samples.size()) {
|
if (nearby_index == m_cached_x_samples.size() || nearby_index + 1 == m_cached_x_samples.size()) {
|
||||||
// Produce more samples until we have enough.
|
// Produce more samples until we have enough.
|
||||||
auto last_t = m_cached_x_samples.is_empty() ? 0 : m_cached_x_samples.last().t;
|
auto last_t = m_cached_x_samples.last().t;
|
||||||
auto last_x = m_cached_x_samples.is_empty() ? 0 : m_cached_x_samples.last().x;
|
auto last_x = m_cached_x_samples.last().x;
|
||||||
while (last_x <= x) {
|
while (last_x <= x && last_t < 1.0) {
|
||||||
last_t += 1. / 60.;
|
last_t += 1. / 60.;
|
||||||
auto solution = solve(last_t);
|
auto solution = solve(last_t);
|
||||||
m_cached_x_samples.append(solution);
|
m_cached_x_samples.append(solution);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue