summaryrefslogtreecommitdiffstats
path: root/scoutapm-upstream.patch
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2019-11-06 12:32:48 +0100
committerRemi Collet <remi@remirepo.net>2019-11-06 12:32:48 +0100
commitbb1f286578c846fb4200e306dde8b5d01edee002 (patch)
tree2d8c41df4587e18ec9e14bc06f52f9d77776a694 /scoutapm-upstream.patch
parentc308a8ed1b71ddb1c0cf0f71c7aad7b718323dc2 (diff)
test build with upstream patch for https://github.com/scoutapp/scout-apm-php-ext/issues/47
Diffstat (limited to 'scoutapm-upstream.patch')
-rw-r--r--scoutapm-upstream.patch52
1 files changed, 52 insertions, 0 deletions
diff --git a/scoutapm-upstream.patch b/scoutapm-upstream.patch
new file mode 100644
index 0000000..3513b94
--- /dev/null
+++ b/scoutapm-upstream.patch
@@ -0,0 +1,52 @@
+From edde934ede6f0d0f17c4e65f4c59ab06b7d43751 Mon Sep 17 00:00:00 2001
+From: James Titcumb <james@asgrim.com>
+Date: Tue, 5 Nov 2019 15:57:29 +0000
+Subject: [PATCH] Fixes segfault that happens when arguments are looped over
+ too high
+
+---
+ package.xml | 33 +++++++++++++++++++++++++--------
+ tests/bug-47.phpt | 20 ++++++++++++++++++++
+ zend_scoutapm.c | 2 +-
+ 3 files changed, 46 insertions(+), 9 deletions(-)
+ create mode 100644 tests/bug-47.phpt
+
+diff --git a/tests/bug-47.phpt b/tests/bug-47.phpt
+new file mode 100644
+index 0000000..e15d34d
+--- /dev/null
++++ b/tests/bug-47.phpt
+@@ -0,0 +1,20 @@
++--TEST--
++Bug https://github.com/scoutapp/scout-apm-php-ext/issues/47 - fix segfault when accessing argument store out of bounds
++--SKIPIF--
++<?php if (!extension_loaded("scoutapm")) die("skip scoutapm extension required."); ?>
++--FILE--
++<?php
++$f1 = fopen(tempnam(sys_get_temp_dir(), 'scoutapm-test'), 'w+');
++$f2 = tmpfile();
++
++fwrite($f2, "fread/fwrite test");
++var_dump(scoutapm_get_calls()[0]['argv']);
++?>
++--EXPECTF--
++Notice: fwrite(): ScoutAPM could not determine arguments for this call in %s
++array(2) {
++ [0]=>
++ resource(%d) of type (%s)
++ [1]=>
++ string(%d) "fread/fwrite test"
++}
+diff --git a/zend_scoutapm.c b/zend_scoutapm.c
+index 98058fe..8d29a08 100644
+--- a/zend_scoutapm.c
++++ b/zend_scoutapm.c
+@@ -346,7 +346,7 @@ void record_arguments_for_call(const char *call_reference, int argc, zval *argv)
+ zend_long find_index_for_recorded_arguments(const char *call_reference)
+ {
+ zend_long i = 0;
+- for (; i <= SCOUTAPM_G(disconnected_call_argument_store_count); i++) {
++ for (; i < SCOUTAPM_G(disconnected_call_argument_store_count); i++) {
+ if (SCOUTAPM_G(disconnected_call_argument_store)[i].reference
+ && strcasecmp(
+ SCOUTAPM_G(disconnected_call_argument_store)[i].reference,