History log of /php-src/ext/phar/tests/gh17137.phpt (Results 1 – 1 of 1)
Revision Date Author Comments
# 142f85e2 13-Dec-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-17137: Segmentation fault ext/phar/phar.c

Commit edae2431 attempted to fix a leak and double free, but didn't
properly understand what was going on, causing a reference count mist

Fix GH-17137: Segmentation fault ext/phar/phar.c

Commit edae2431 attempted to fix a leak and double free, but didn't
properly understand what was going on, causing a reference count mistake
and subsequent segfault in this case.

The first mistake of that commit is that the reference count should've
been increased because we're reusing a phar object. The error handling
path should've gotten changed instead to undo this refcount increase
instead of not refcounting at all (root cause of this bug).

The second mistake is that the alias isn't supposed to be transferred or
whatever, that just doesn't make sense. The reason the test
bug69958.phpt originally leaked is because in the non-reuse case we
borrowed the alias and otherwise we own the alias. If we own the alias
the alias information shouldn't get deleted anyway as that would desync
the alias map.

Fixing these will reveal a third issue in which the alias memory is not
always properly in sync with the persistence-ness of the phar, fix this
as well.

Closes GH-17150.

show more ...