[php-src] PR #22380: ext/gd: fix out-of-bounds write reading font header on short reads

From: Date: Sun, 21 Jun 2026 11:03:29 +0000
Subject: [php-src] PR #22380: ext/gd: fix out-of-bounds write reading font header on short reads
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-36527@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/22380 Author: iliaal imageloadfont() indexes the header copy with (char*)&font[b], which scales the byte counter b by sizeof(gdFont) rather than advancing one byte, so a short php_stream_read() (deliverable by a user stream wrapper) writes hdr_size-b bytes past the emalloc(sizeof(gdFont)) buffer. Byte-index the destination to match the body read a few lines below. #15231 rewrites the same loop to read into a sized buffer and would also resolve this, but it has been idle since March, so this is the minimal targeted fix.

« previous php.git-pulls (#36527) next »