Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-88355 Overview
CVE-2026-88355 is an incorrect buffer size calculation vulnerability in the tinyexpr expression parser library at commit 4a7456e. The flaw resides in the new_expr() function, which allocates insufficient memory for arity-0 expression nodes including constants, variables, and zero-argument functions. The allocation is smaller than sizeof(te_expr), yet the returned pointer is treated as a complete te_expr object. This produces undefined behavior and deterministic process termination in builds instrumented with UndefinedBehaviorSanitizer (UBSan).
Critical Impact
Applications embedding vulnerable tinyexpr builds can experience memory corruption or forced process termination when parsing attacker-influenced expressions containing constants, variables, or zero-argument functions.
Affected Products
- tinyexpr expression parser library at commit 4a7456e
- Downstream applications that embed vulnerable tinyexpr builds
- UBSan-instrumented builds that will terminate deterministically on trigger
Discovery Timeline
- 2026-09-24 - CVE-2026-88355 published to NVD
- 2026-09-24 - Last updated in NVD database
Technical Details for CVE-2026-88355
Vulnerability Analysis
The tinyexpr library represents expression nodes using the te_expr structure, which embeds a trailing parameters[1] array intended as a variable-length tail. The new_expr() function computes allocation size by subtracting one void* from sizeof(te_expr) and then adding space for the actual parameter count. For nodes with arity zero, this subtraction produces an allocation strictly smaller than sizeof(te_expr). The returned pointer is then written to and read from as a full te_expr, violating object-size invariants [CWE-131]. In sanitizer builds this triggers a fatal diagnostic. In production builds the undersized allocation can produce out-of-bounds writes into adjacent heap metadata or neighboring allocations.
Root Cause
The root cause is an off-by-one assumption in the size formula combined with the use of a fixed-length parameters[1] member in the structure definition. When arity == 0, the psize term is zero and the base term sizeof(te_expr) - sizeof(void*) yields fewer bytes than the compiler-reported size of the struct. Field accesses on the returned pointer then operate outside the allocated region.
Attack Vector
Exploitation requires the application to parse an expression controlled or influenced by an attacker. Any input that creates arity-0 nodes, such as numeric constants, bound variables, or zero-argument functions, exercises the vulnerable path. The impact depends on the embedding application: at minimum, UBSan-instrumented services terminate on parse. Non-instrumented builds exhibit heap corruption with potential for availability loss or further exploitation.
// Patch for tinyexpr.c - correct the allocation size for te_expr
static te_expr *new_expr(const int type, const te_expr *parameters[]) {
const int arity = ARITY(type);
const int psize = sizeof(void*) * arity;
- const int size = (sizeof(te_expr) - sizeof(void*)) + psize + (IS_CLOSURE(type) ? sizeof(void*) : 0);
+ const int size = sizeof(te_expr) + psize + (IS_CLOSURE(type) ? sizeof(void*) : 0);
te_expr *ret = malloc(size);
CHECK_NULL(ret);
Source: GitHub Commit fe74597
Detection Methods for CVE-2026-88355
Indicators of Compromise
- Unexpected process termination with UBSan diagnostics referencing new_expr or te_expr field access
- Heap corruption aborts (malloc_consolidate, free(): invalid pointer) originating from the expression-parsing code path
- Crash dumps whose stack trace includes te_compile or te_interp immediately prior to the fault
Detection Strategies
- Perform a software bill of materials (SBOM) scan for tinyexpr sources at or before commit 4a7456e
- Rebuild dependent binaries with -fsanitize=undefined,address in a staging environment to surface the undersized allocation at runtime
- Review source trees for the vulnerable formula (sizeof(te_expr) - sizeof(void*)) + psize inside new_expr()
Monitoring Recommendations
- Alert on repeated crash signatures from services that parse user-supplied mathematical expressions
- Monitor application telemetry for abnormal termination rates following deployment of expression-parsing features
- Capture core dumps from affected services to confirm the fault originates in tinyexpr rather than surrounding code
How to Mitigate CVE-2026-88355
Immediate Actions Required
- Inventory all first-party and third-party components that embed tinyexpr and identify builds based on commit 4a7456e or earlier
- Apply the upstream fix from commit fe74597 and rebuild all dependent artifacts
- Restrict exposure of expression-parsing endpoints to authenticated or trusted callers until patched
Patch Information
The fix is published in commit fe7459728c2ab8d2f91365abe56601cdd0e24f9b. It changes the structure definition to use a C99 flexible array member (void *parameters[]) and corrects the allocation size in new_expr() to sizeof(te_expr) + psize + (IS_CLOSURE(type) ? sizeof(void*) : 0). See the GitHub Commit fe74597 Update and the GitHub Issue #145 Discussion for context.
Workarounds
- Validate and constrain expression inputs to reject untrusted content until patches are deployed
- Disable features that invoke te_compile or te_interp on attacker-reachable paths
- Rebuild with hardened allocators or -D_FORTIFY_SOURCE=2 to improve detection of heap corruption while a patch is scheduled
// Patch for tinyexpr.h - use a C99 flexible array member
typedef struct te_expr {
int type;
union {double value; const double *bound; const void *function;};
- void *parameters[1];
+ void *parameters[];
} te_expr;
Source: GitHub Commit fe74597
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

