mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 15:45:25 +00:00
LibJS: Don't infinite loop on unknown console.log formatting specifiers
This commit is contained in:
committed by
Andreas Kling
parent
84351dfa51
commit
ef9208047d
@@ -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 {};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user