mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-29 02:50:26 +00:00
LibJS: Don't infinite loop on unknown console.log formatting specifiers
This commit is contained in:
parent
84351dfa51
commit
ef9208047d
Notes:
github-actions[bot]
2024-09-26 08:15:20 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/ef9208047dc Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1537
3 changed files with 9 additions and 1 deletions
|
@ -0,0 +1 @@
|
||||||
|
PASS (didn't hang)
|
|
@ -0,0 +1,7 @@
|
||||||
|
<script src="../include.js"></script>
|
||||||
|
<script>
|
||||||
|
test(() => {
|
||||||
|
console.log("%z%z", 1, 2);
|
||||||
|
println("PASS (didn't hang)");
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -818,7 +818,7 @@ ThrowCompletionOr<MarkedVector<Value>> ConsoleClient::formatter(MarkedVector<Val
|
||||||
auto find_specifier = [](StringView target) -> Optional<StringView> {
|
auto find_specifier = [](StringView target) -> Optional<StringView> {
|
||||||
size_t start_index = 0;
|
size_t start_index = 0;
|
||||||
while (start_index < target.length()) {
|
while (start_index < target.length()) {
|
||||||
auto maybe_index = target.find('%');
|
auto maybe_index = target.find('%', start_index);
|
||||||
if (!maybe_index.has_value())
|
if (!maybe_index.has_value())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue