Skip to content
Heist/ feed
Back to feed
Medium

Integer Overflow Leading to Heap Buffer Overflow in cJSON

Type: advisorySources: OSV

cJSON library is vulnerable to an integer overflow in the print_string_ptr() function in cJSON.c on 32-bit platforms. The escape_characters counter, a 32-bit size_t, can wrap around when processing strings containing approximately 858,993,460 or more control characters, causing the output buffer to be allocated based on an underestimated length. When cJSON_PrintBuffered() is used with a pre-allocated buffer, the subsequent write loop overflows the heap allocation. An attacker supplying a crafted JSON string to an application using cJSON on a 32-bit platform can cause a heap buffer overflow, potentially leading to remote code execution, information disclosure, or denial of service. Because project creator contact attempts were unsuccessful, the vulnerability has only been confirmed in version 1.7.19 but may also affect other versions.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2026-16554
Confirmed fixed CVEs
Not specified
Updated in this feed
4 Nov 2026, 17:40 UTC · Revision 1

Source evidence

Integer Overflow Leading to Heap Buffer Overflow in cJSON

core-osv · Original source

Published 27 Jul 2026, 08:40 UTC

cJSON library is vulnerable to an integer overflow in the print_string_ptr() function in cJSON.c on 32-bit platforms. The escape_characters counter, a 32-bit size_t, can wrap around when processing strings containing approximately 858,993,460 or more control characters, causing the output buffer to be allocated based on an underestimated length. When cJSON_PrintBuffered() is used with a pre-allocated buffer, the subsequent write loop overflows the heap allocation. An attacker supplying a crafted JSON string to an application using cJSON on a 32-bit platform can cause a heap buffer overflow, potentially leading to remote code execution, information disclosure, or denial of service. Because project creator contact attempts were unsuccessful, the vulnerability has only been confirmed in version 1.7.19 but may also affect other versions.

osv:CVE-2026-16554
Complete source record
{
  "id": "8834569748cf04a3ac8c56ea321667a965950b898ad6e39e032df6c2d1258a85",
  "url": "https://osv.dev/vulnerability/CVE-2026-16554",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Integer Overflow Leading to Heap Buffer Overflow in cJSON",
    "summary": "cJSON library is vulnerable to an integer overflow in the print_string_ptr() function in cJSON.c on 32-bit platforms. The escape_characters counter, a 32-bit size_t, can wrap around when processing strings containing approximately 858,993,460 or more control characters, causing the output buffer to be allocated based on an underestimated length. When cJSON_PrintBuffered() is used with a pre-allocated buffer, the subsequent write loop overflows the heap allocation. An attacker supplying a crafted JSON string to an application using cJSON on a 32-bit platform can cause a heap buffer overflow, potentially leading to remote code execution, information disclosure, or denial of service. Because project creator contact attempts were unsuccessful, the vulnerability has only been confirmed in version 1.7.19 but may also affect other versions.",
    "evidence": "osv:CVE-2026-16554",
    "products": [],
    "severity": "medium",
    "structured": {
      "id": "CVE-2026-16554",
      "aliases": [
        "CVE-2026-16554"
      ],
      "metrics": [
        {
          "type": "CVSS_V4",
          "score": "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:L/SI:L/SA:L"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/davegamble/cjson",
              "type": "GIT",
              "events": [
                {
                  "introduced": "c859b25da02955fef659d658b8f324b5cde87be3"
                },
                {
                  "last_affected": "c859b25da02955fef659d658b8f324b5cde87be3"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "range": [
                      {
                        "introduced": "1.7.19"
                      },
                      {
                        "last_affected": "1.7.19"
                      }
                    ],
                    "source": "AFFECTED_FIELD",
                    "strategy": "StandaloneSingleVersion"
                  },
                  {
                    "cpe": "cpe:2.3:a:davegamble:cjson:1.7.19:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "1.7.19"
                      },
                      {
                        "last_affected": "1.7.19"
                      }
                    ],
                    "source": "CPE_STRING"
                  }
                ]
              }
            }
          ],
          "versions": [
            "1.7.19",
            "v1.7.19"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-16554.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:37.950954486Z",
      "provider": "osv",
      "references": [
        "https://cert.pl/en/posts/2026/07/CVE-2026-16554",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/16xxx/CVE-2026-16554.json",
        "https://nvd.nist.gov/vuln/detail/CVE-2026-16554",
        "https://github.com/DaveGamble/cJSON"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-190"
        ],
        "cna_assigner": "CERT-PL",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/16xxx/CVE-2026-16554.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2026-16554",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 505399,
  "published_at": "2026-07-27T08:40:17.183+00:00"
}