Vendors › PHP

CVE-2025-14178

Medium (6.5) EPSS 0.6% PHP · core

Heap buffer overflow in array_merge()

The following PHP code triggers a reliable heap buffer overflow: php $arr = range(0, 2**29); array_merge($arr, $arr, $arr, $arr, $arr, $arr, $arr, $arr); Or the general case: php $power = 24; // You can choose this number 1 <= $power < 32 $arr = range(0, 2**$power); array_merge(...array_fill(0, 2**(32-$power), $arr)); This is because packed arrays in array_merge() have an optimization that requires precomputing the count of the elements, done using count += zend_hash_num_elements(Z_ARRVAL_P(arg));. However, this may overflow.

Published2025-12-18
Updated2025-12-19
AffectedPHP versions < 8.1.34; PHP versions < 8.2.30; PHP versions < 8.3.29; PHP versions < 8.4.16; PHP versions < 8.5.1
FixUpgrade to 8.1.34, 8.2.30, 8.3.29, 8.4.16, 8.5.1 (first fixed release per supported branch).
Vendor advisoryhttps://github.com/php/php-src/security/advisories/GHSA-h96m-rvf9-jgm2

CVEs (1)

CVECWETypeImpactLinks
CVE-2025-14178CWE-190;CWE-787OverflowCode ExecutionNVD · CVE.org · EUVD

CWE, type and impact come from the NVD enrichment pass; unfilled rows are pending enrichment.

Same CVE in other advisories

Open in the CVEMesh app Create a free account

Track this advisory against your own stack — add your assets and CVEMesh shows which advisories actually apply to the versions you run.

CVEMesh aggregates public vendor advisories as guidance; always verify against the vendor's official advisory before patching or upgrading.