From f8ea5648b34b9fe4f7d64e8eddc888fab7b64d9f Mon Sep 17 00:00:00 2001 From: Jakub Zelenka Date: Sun, 22 Nov 2026 14:04:45 +0100 Subject: [PATCH] Fix memory corruption when cloning objects by disallowing clone --- gnupg.c | 1 + gnupg_keylistiterator.c | 1 + 2 files changed, 2 insertions(+) diff --git a/gnupg.c b/gnupg.c index 52e72de..4f1023a 100644 --- a/gnupg.c +++ b/gnupg.c @@ -533,6 +533,7 @@ PHP_MINIT_FUNCTION(gnupg) memcpy(&gnupg_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); gnupg_object_handlers.offset = offsetof(gnupg_object, std); gnupg_object_handlers.free_obj = gnupg_object_free; + gnupg_object_handlers.clone_obj = NULL; if (SUCCESS != gnupg_keylistiterator_init(type, module_number)) { return FAILURE; diff --git a/gnupg_keylistiterator.c b/gnupg_keylistiterator.c index 17022bf..012c42b 100644 --- a/gnupg_keylistiterator.c +++ b/gnupg_keylistiterator.c @@ -136,6 +136,7 @@ int gnupg_keylistiterator_init(INIT_FUNC_ARGS) memcpy(&gnupg_keylistiterator_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); gnupg_keylistiterator_handlers.offset = offsetof(gnupg_keylistiterator_object, std); gnupg_keylistiterator_handlers.free_obj = gnupg_keylistiterator_object_free; + gnupg_keylistiterator_handlers.clone_obj = NULL; zend_class_implements(gnupg_keylistiterator_class_entry, 1, zend_ce_iterator);