[php-src] PR #17811: Fix GH-17808: PharFileInfo refcount bug

From: Date: Sat, 15 Feb 2025 11:47:29 +0000
Subject: [php-src] PR #17811: Fix GH-17808: PharFileInfo refcount bug
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-30790@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/17811 Author: nielsdos PharFileInfo just takes a pointer from the manifest without refcounting anything. If the entry is then removed from the manifest while the PharFileInfo object still exists, we get a UAF. We fix this by using the fp_refcount field. This is technically a behaviour change as the unlinking is now blocked, and potentially file modifications can be blocked as well. The alternative would be to have a field that indicates whether deletion is blocked, but similar corruption bugs may occur as well with file overwrites, so we increment fp_refcount instead. This also fixes an issue where a destructor called multiple times resulted in a UAF as well, by moving the NULL'ing of the entry field out of the if.

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