mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
AK: Disallow implicit pointer-to-boolean conversion in JsonValue
Similar to how LibJS and LibSQL used to behave, the boolean constructor of JsonValue is currently allowing pointers to be used to construct a boolean value. Explicitly disallow such construction.
This commit is contained in:
parent
174062e0c5
commit
63e2aa962d
Notes:
sideshowbarker
2024-07-17 04:57:23 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/63e2aa962d Pull-request: https://github.com/SerenityOS/serenity/pull/16384
2 changed files with 9 additions and 7 deletions
|
@ -168,12 +168,6 @@ JsonValue::JsonValue(double value)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
JsonValue::JsonValue(bool value)
|
|
||||||
: m_type(Type::Bool)
|
|
||||||
{
|
|
||||||
m_value.as_bool = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
JsonValue::JsonValue(DeprecatedString const& value)
|
JsonValue::JsonValue(DeprecatedString const& value)
|
||||||
{
|
{
|
||||||
if (value.is_null()) {
|
if (value.is_null()) {
|
||||||
|
|
|
@ -55,12 +55,20 @@ public:
|
||||||
#if !defined(KERNEL)
|
#if !defined(KERNEL)
|
||||||
JsonValue(double);
|
JsonValue(double);
|
||||||
#endif
|
#endif
|
||||||
JsonValue(bool);
|
|
||||||
JsonValue(char const*);
|
JsonValue(char const*);
|
||||||
#ifndef KERNEL
|
#ifndef KERNEL
|
||||||
JsonValue(DeprecatedString const&);
|
JsonValue(DeprecatedString const&);
|
||||||
#endif
|
#endif
|
||||||
JsonValue(StringView);
|
JsonValue(StringView);
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
requires(SameAs<RemoveCVReference<T>, bool>)
|
||||||
|
JsonValue(T value)
|
||||||
|
: m_type(Type::Bool)
|
||||||
|
, m_value { .as_bool = value }
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
JsonValue(JsonArray const&);
|
JsonValue(JsonArray const&);
|
||||||
JsonValue(JsonObject const&);
|
JsonValue(JsonObject const&);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue