<?phpclass S extends SplObjectStorage { public$other; publicfunctiongetHash($obj): string { if ($this->other) { $this->other->offsetUnset($obj); // free element $this->other = null; }
return"x"; // not in this storage -> enter if-block
} }
$storage = newSplObjectStorage(); $obj = newstdClass();
$storage->offsetSet($obj);
$filter = newS(); $filter->other = $storage;
$storage->removeAllExcept($filter); // UAF here
Description
Originally reported by @kdsjZh.
The following code:
PHP Version
Operating System
No response