Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmb69/82c0511b5cee0ea12b9507e61d5bba4a to your computer and use it in GitHub Desktop.
Save cmb69/82c0511b5cee0ea12b9507e61d5bba4a to your computer and use it in GitHub Desktop.
Fix for PHP bug #80817
From 1464cd6a8f8ec18de2254c3495aa97c2f175c79c Mon Sep 17 00:00:00 2001
From: "Christoph M. Becker" <cmbecker69@gmx.de>
Date: Mon, 1 Mar 2021 18:14:26 +0100
Subject: [PATCH] Fix #80817: dba_popen() may cause segfault during RSHUTDOWN
We need to close persistent streams with the proper flag.
---
ext/dba/dba.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ext/dba/dba.c b/ext/dba/dba.c
index 952993582b..9581a57148 100644
--- a/ext/dba/dba.c
+++ b/ext/dba/dba.c
@@ -972,9 +972,9 @@ restart:
zend_bool close_both;
close_both = (info->fp != info->lock.fp);
- php_stream_close(info->lock.fp);
+ php_stream_free(info->lock.fp, persistent ? PHP_STREAM_FREE_CLOSE_PERSISTENT : PHP_STREAM_FREE_CLOSE);
if (close_both) {
- php_stream_close(info->fp);
+ php_stream_free(info->fp, persistent ? PHP_STREAM_FREE_CLOSE_PERSISTENT : PHP_STREAM_FREE_CLOSE);
}
info->fp = NULL;
info->lock.fp = NULL;
--
2.30.1.windows.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment