From acd46b597482a8d34fcc4ee87360bd93f2cbac5f Mon Sep 17 00:00:00 2001 From: Jonatan Klemets Date: Wed, 30 Aug 2023 20:26:24 +0300 Subject: [PATCH] LibWeb: Fix int parsing in Document::shared_declarative_refresh_steps We now have functions for parsing integers in a spec-compliant way. This patch replaces the `to_uint` call with a call to the spec-compliant `Web::HTML::parse_non_negative_integer` function. --- Userland/Libraries/LibWeb/DOM/Document.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 435668b090..5303309a3d 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -71,6 +71,7 @@ #include #include #include +#include #include #include #include @@ -3370,8 +3371,7 @@ void Document::shared_declarative_refresh_steps(StringView input, JS::GCPtr(); + auto maybe_time = Web::HTML::parse_non_negative_integer(time_string); // FIXME: Since we only collected ASCII digits, this can only fail because of overflow. What do we do when that happens? For now, default to 0. if (maybe_time.has_value() && maybe_time.value() < NumericLimits::max() && !Checked::multiplication_would_overflow(static_cast(maybe_time.value()), 1000)) {