File php7-bsc1175508.patch of Package php7.22873

From d66e48b5b6574f91e5dbd0a73c4ae3b62874a47a Mon Sep 17 00:00:00 2001
From: Nikita Popov <nikita.ppv@gmail.com>
Date: Mon, 30 Aug 2021 16:31:28 +0200
Subject: [PATCH] Error on resource ID space overflow

---
 Zend/zend_list.c | 2 ++
 1 file changed, 2 insertions(+)

Index: php-7.4.6/Zend/zend_list.c
===================================================================
--- php-7.4.6.orig/Zend/zend_list.c	2021-10-04 13:04:05.596024043 +0200
+++ php-7.4.6/Zend/zend_list.c	2021-10-04 13:07:26.869206163 +0200
@@ -37,6 +37,8 @@ ZEND_API zval* ZEND_FASTCALL zend_list_i
 	index = zend_hash_next_free_element(&EG(regular_list));
 	if (index == 0) {
 		index = 1;
+	} else if (index == INT_MAX) {
+		zend_error_noreturn(E_ERROR, "Resource ID space overflow");
 	}
 	ZVAL_NEW_RES(&zv, index, ptr, type);
 	return zend_hash_index_add_new(&EG(regular_list), index, &zv);
openSUSE Build Service is sponsored by