new file mode 100644
@@ -0,0 +1,67 @@
+From 3bbcec9dee9219f1281a6e4dd28e5df3ea779c01 Mon Sep 17 00:00:00 2001
+From: Ann Leelu George <annleelu.george@windriver.com>
+Date: Tue, 6 Oct 2026 15:56:42 +0000
+Subject: [PATCH] Compare: avoid exponential recursion in cJSON_Compare
+ (CVE-2026-67216)
+
+cJSON_Compare() compared object subtrees twice, once in each direction,
+recursing fully in both passes. The second pass existed only to reject the
+case where a is a subset of b, but it re-ran cJSON_Compare() on every shared
+child. For structurally equal, deeply nested objects this doubles the work at
+every level, so the running time is exponential in the nesting depth: a small
+(few-hundred-byte) document nested ~40 levels can consume hours of CPU. An
+application that calls cJSON_Compare() on attacker-influenced JSON that is
+structurally equal to a reference document is exposed to a denial of service.
+
+The forward pass already deep-compares every key of a against its counterpart
+in b. The reverse pass therefore only needs to confirm that b has no keys
+absent from a - a presence check, not a recursive comparison. Replace the
+second cJSON_Compare() call with a get_object_item() lookup so each shared
+subtree is compared exactly once. This removes the per-level doubling and
+makes the runtime linear in the tree size (the pre-existing O(n^2) key lookup
+is unchanged). Semantics are preserved for objects without duplicate keys:
+unequal values are still caught by the forward pass, and extra keys in b
+are still rejected. With duplicate keys, cJSON_Compare already matches
+only the first occurrence on lookup, so results there were not well
+defined before this change either.
+
+CVE: CVE-2026-67216
+Upstream-Status: Submitted [https://github.com/DaveGamble/cJSON/pull/1146]
+Signed-off-by: Ann Leelu George <annleelu.george@windriver.com>
+---
+ cJSON.c | 12 +++++-------
+ 1 file changed, 5 insertions(+), 7 deletions(-)
+
+diff --git a/cJSON.c b/cJSON.c
+index 88c2d95..09ba85e 100644
+--- a/cJSON.c
++++ b/cJSON.c
+@@ -3170,8 +3170,11 @@ CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * cons
+ }
+ }
+
+- /* doing this twice, once on a and b to prevent true comparison if a subset of b
+- * TODO: Do this the proper way, this is just a fix for now */
++ /* Check that b has no keys absent from a. a's keys were already
++ * deep-compared against b above, so here a presence check is
++ * enough. Recursively comparing again in this direction would
++ * compare every shared subtree twice per level, making the
++ * runtime exponential in the nesting depth (CVE-2026-67216). */
+ cJSON_ArrayForEach(b_element, b)
+ {
+ a_element = get_object_item(a, b_element->string, case_sensitive);
+@@ -3179,11 +3182,6 @@ CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * cons
+ {
+ return false;
+ }
+-
+- if (!cJSON_Compare(b_element, a_element, case_sensitive))
+- {
+- return false;
+- }
+ }
+
+ return true;
+--
+2.54.0
+
@@ -8,6 +8,7 @@ SRC_URI = "git://github.com/DaveGamble/cJSON.git;branch=master;protocol=https;ta
file://run-ptest \
file://0001-allow-build-with-cmake-4.patch \
file://CVE-2026-87933.patch \
+ file://CVE-2026-67216.patch \
file://0001-CMake-Install-to-relative-destinations.patch \
"
SRCREV = "c859b25da02955fef659d658b8f324b5cde87be3"
cJSON_Compare() compares object members twice, once in each direction, recursing fully in both passes, so comparing structurally equal nested objects takes time exponential in the nesting depth. A few-hundred-byte document nested ~40 levels deep can consume hours of CPU (denial of service). Backport the fix submitted upstream, which replaces the redundant reverse-direction recursive compare with a presence check so each shared subtree is compared once. CVE: CVE-2026-67216 Signed-off-by: Ann Leelu George <annleelu.george@windriver.com> --- .../cjson/cjson/CVE-2026-67216.patch | 67 +++++++++++++++++++ .../recipes-devtools/cjson/cjson_1.7.19.bb | 1 + 2 files changed, 68 insertions(+) create mode 100644 meta-oe/recipes-devtools/cjson/cjson/CVE-2026-67216.patch