Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed bug #885: missing validation point returned by strchr in xdebug…

…_error_cb.
  • Loading branch information...
commit 9405c43592973ab90bf2baf921f180438e53a927 1 parent f0180b5
@derickr derickr authored
Showing with 14 additions and 2 deletions.
  1. +8 −0 tests/bug00885.phpt
  2. +6 −2 xdebug_stack.c
View
8 tests/bug00885.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Test for bug #885: missing validation point returned by strchr in xdebug_error_cb.
+--FILE--
+<?php
+throw new Exception("long message ".str_repeat('.', 10240));
+?>
+--EXPECTF--
+Fatal error: Uncaught exception 'Exception' with message 'long message ...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... in %sbug00885.php on line 2
View
8 xdebug_stack.c
@@ -622,8 +622,12 @@ void xdebug_error_cb(int type, const char *error_filename, const uint error_line
/* find first new line */
p = strchr(buffer, '\n');
- /* find last quote */
- p = ((char *) zend_memrchr(buffer, '\'', p - buffer)) + 1;
+ if (!p) {
+ p = buffer + strlen(buffer);
+ } else {
+ /* find last quote */
+ p = ((char *) zend_memrchr(buffer, '\'', p - buffer)) + 1;
+ }
/* Create new buffer */
tmp_buf = calloc(p - buffer + 1, 1);
strncpy(tmp_buf, buffer, p - buffer );
Please sign in to comment.
Something went wrong with that request. Please try again.