Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix bug and add test for dba_open same file twice #17979

Open
wants to merge 1 commit into
base: PHP-8.4
Choose a base branch
from

Conversation

chschneider
Copy link

When doing dba_open twice with the same file then dba_open tries to insert the same key into its hash table which triggers an assertion in a debug build and causes memory corruption in production.

A small reproduction script is

<?php
$a = dba_open("ext/dba/tests/test.cdb", "r");
$b = dba_open("ext/dba/tests/test.cdb", "r");
var_dump($a, $b);

The solution I chose is to add a counter to the keys generated with dba_open (but no dba_popen) to avoid key collisions.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant