File tree Expand file tree Collapse file tree 5 files changed +28
-9
lines changed Expand file tree Collapse file tree 5 files changed +28
-9
lines changed Original file line number Diff line number Diff line change 11ArduinoJson: change log
22=======================
33
4+ HEAD
5+ ----
6+
7+ * Forbid ` deserializeJson(JsonArray|JsonObject, ...) ` (issue #2135 )
8+
49v7.2.0 (2024-09-18)
510------
611
Original file line number Diff line number Diff line change @@ -34,3 +34,6 @@ build_should_fail(variant_as_char)
3434
3535add_executable (assign_char assign_char.cpp)
3636build_should_fail(assign_char)
37+
38+ add_executable (deserialize_object deserialize_object.cpp)
39+ build_should_fail(deserialize_object)
Original file line number Diff line number Diff line change 1+ // ArduinoJson - https://arduinojson.org
2+ // Copyright © 2014-2024, Benoit BLANCHON
3+ // MIT License
4+
5+ #include < ArduinoJson.h>
6+
7+ // See issue #2135
8+
9+ int main () {
10+ JsonObject obj;
11+ deserializeJson (obj, " " );
12+ }
Original file line number Diff line number Diff line change @@ -24,14 +24,10 @@ struct first_or_void<T, Rest...> {
2424
2525// A meta-function that returns true if T is a valid destination type for
2626// deserialize()
27- template <class T , class = void >
28- struct is_deserialize_destination : false_type {};
29-
3027template <class T >
31- struct is_deserialize_destination <
32- T, enable_if_t <is_same<decltype (VariantAttorney::getResourceManager(
33- detail::declval<T&>())),
34- ResourceManager*>::value>> : true_type {};
28+ using is_deserialize_destination =
29+ bool_constant<is_base_of<JsonDocument, remove_cv_t <T>>::value ||
30+ IsVariant<T>::value>;
3531
3632template <typename TDestination>
3733inline void shrinkJsonDocument (TDestination&) {
Original file line number Diff line number Diff line change @@ -13,7 +13,10 @@ struct integral_constant {
1313 static const T value = v;
1414};
1515
16- typedef integral_constant<bool , true > true_type;
17- typedef integral_constant<bool , false > false_type;
16+ template <bool B>
17+ using bool_constant = integral_constant<bool , B>;
18+
19+ using true_type = bool_constant<true >;
20+ using false_type = bool_constant<false >;
1821
1922ARDUINOJSON_END_PRIVATE_NAMESPACE
You can’t perform that action at this time.
0 commit comments