mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 12:35:14 +00:00
LibCore+LibJS+LibWasm: Always use a real format string
It's generally considered a security issue to use non-format string literals. We would likely just crash in practice, but let's avoid the issue altogether.
This commit is contained in:
parent
6362ec6f3d
commit
4e834964c9
3 changed files with 11 additions and 11 deletions
|
@ -384,7 +384,7 @@ void ArgsParser::print_version(FILE* file)
|
|||
{
|
||||
// FIXME: Allow applications to override version string for --version.
|
||||
// Especially useful for Lagom applications
|
||||
outln(file, Core::Version::read_long_version_string());
|
||||
outln(file, "{}", Core::Version::read_long_version_string());
|
||||
}
|
||||
|
||||
void ArgsParser::add_option(Option&& option)
|
||||
|
|
|
@ -154,7 +154,7 @@ ErrorOr<void> print_type(JS::PrintContext& print_context, StringView name)
|
|||
|
||||
ErrorOr<void> print_separator(JS::PrintContext& print_context, bool& first)
|
||||
{
|
||||
TRY(js_out(print_context, first ? " "sv : ", "sv));
|
||||
TRY(js_out(print_context, "{}", first ? " "sv : ", "sv));
|
||||
first = false;
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -137,13 +137,13 @@ void Printer::print(Wasm::DataSection::Data const& data)
|
|||
[this](DataSection::Data::Passive const& value) {
|
||||
print_indent();
|
||||
print("(passive init {}xu8 (", value.init.size());
|
||||
print(ByteString::join(' ', value.init, "{:x}"sv));
|
||||
print("{}", ByteString::join(' ', value.init, "{:x}"sv));
|
||||
print(")\n");
|
||||
},
|
||||
[this](DataSection::Data::Active const& value) {
|
||||
print_indent();
|
||||
print("(active init {}xu8 (", value.init.size());
|
||||
print(ByteString::join(' ', value.init, "{:x}"sv));
|
||||
print("{}", ByteString::join(' ', value.init, "{:x}"sv));
|
||||
print("\n");
|
||||
{
|
||||
TemporaryChange change { m_indent, m_indent + 1 };
|
||||
|
@ -659,26 +659,26 @@ void Printer::print(Wasm::Value const& value, Wasm::ValueType const& type)
|
|||
print_indent();
|
||||
switch (type.kind()) {
|
||||
case ValueType::I32:
|
||||
print(ByteString::formatted("{}", value.to<i32>()));
|
||||
print("{}", value.to<i32>());
|
||||
break;
|
||||
case ValueType::I64:
|
||||
print(ByteString::formatted("{}", value.to<i64>()));
|
||||
print("{}", value.to<i64>());
|
||||
break;
|
||||
case ValueType::F32:
|
||||
print(ByteString::formatted("{}", value.to<f32>()));
|
||||
print("{}", value.to<f32>());
|
||||
break;
|
||||
case ValueType::F64:
|
||||
print(ByteString::formatted("{}", value.to<f64>()));
|
||||
print("{}", value.to<f64>());
|
||||
break;
|
||||
case ValueType::V128:
|
||||
print(ByteString::formatted("v128({:x})", value.value()));
|
||||
print("v128({:x})", value.value());
|
||||
break;
|
||||
case ValueType::FunctionReference:
|
||||
case ValueType::ExternReference:
|
||||
print(ByteString::formatted("addr({})",
|
||||
print("addr({})",
|
||||
value.to<Reference>().ref().visit(
|
||||
[](Wasm::Reference::Null const&) { return ByteString("null"); },
|
||||
[](auto const& ref) { return ByteString::number(ref.address.value()); })));
|
||||
[](auto const& ref) { return ByteString::number(ref.address.value()); }));
|
||||
break;
|
||||
}
|
||||
TemporaryChange<size_t> change { m_indent, 0 };
|
||||
|
|
Loading…
Add table
Reference in a new issue