summaryrefslogtreecommitdiffstats
path: root/0005-fix-segfault-in-013.solrclient_getByIds.sh.patch
diff options
context:
space:
mode:
Diffstat (limited to '0005-fix-segfault-in-013.solrclient_getByIds.sh.patch')
-rw-r--r--0005-fix-segfault-in-013.solrclient_getByIds.sh.patch53
1 files changed, 53 insertions, 0 deletions
diff --git a/0005-fix-segfault-in-013.solrclient_getByIds.sh.patch b/0005-fix-segfault-in-013.solrclient_getByIds.sh.patch
new file mode 100644
index 0000000..109b604
--- /dev/null
+++ b/0005-fix-segfault-in-013.solrclient_getByIds.sh.patch
@@ -0,0 +1,53 @@
+From 9c0e23403876814f2812b4bad04989873194c91f Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@php.net>
+Date: Fri, 12 Oct 2018 14:10:54 +0200
+Subject: [PATCH 5/5] fix segfault in 013.solrclient_getByIds.sh
+
+---
+ src/php7/php_solr_client.c | 26 ++++++++++++++------------
+ 1 file changed, 14 insertions(+), 12 deletions(-)
+
+diff --git a/src/php7/php_solr_client.c b/src/php7/php_solr_client.c
+index 3c76f52..8bad5df 100644
+--- a/src/php7/php_solr_client.c
++++ b/src/php7/php_solr_client.c
+@@ -1346,22 +1346,24 @@ PHP_METHOD(SolrClient, getByIds)
+
+ solr_string_init(&query_string);
+ solr_string_appends(&query_string, "ids=", sizeof("ids=")-1);
+- SOLR_HASHTABLE_FOR_LOOP(ids)
+- {
+- zval *id_zv = NULL;
+- id_zv = zend_hash_get_current_data(ids);
+- if (Z_TYPE_P(id_zv) == IS_STRING && Z_STRLEN_P(id_zv)) {
+- solr_string_appends(&query_string, Z_STRVAL_P(id_zv), Z_STRLEN_P(id_zv));
+- solr_string_appendc(&query_string, ',');
+- } else {
+- invalid_param = 1;
+- goto solr_getbyids_exit;
++
++ if (ids->nNumOfElements) {
++ SOLR_HASHTABLE_FOR_LOOP(ids)
++ {
++ zval *id_zv = NULL;
++ id_zv = zend_hash_get_current_data(ids);
++ if (Z_TYPE_P(id_zv) == IS_STRING && Z_STRLEN_P(id_zv)) {
++ solr_string_appends(&query_string, Z_STRVAL_P(id_zv), Z_STRLEN_P(id_zv));
++ solr_string_appendc(&query_string, ',');
++ } else {
++ invalid_param = 1;
++ goto solr_getbyids_exit;
++ }
++ current_position++;
+ }
+- current_position++;
+ }
+
+
+-
+ solr_getbyids_exit:
+ if (invalid_param) {
+ solr_string_free(&query_string);
+--
+2.14.4
+