com php-src: Fixed segfault when listing and last line is empty: phpdbg_list.c

From: Date: Thu, 09 Oct 2014 10:43:53 +0000
Subject: com php-src: Fixed segfault when listing and last line is empty: phpdbg_list.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-82586@lists.php.net to get a copy of this message
Commit: a54de936d028033304f385947fd67d69ae813fc5 Author: Bob Weinand <bobwei9@hotmail.com> Thu, 9 Oct 2014 12:43:53 +0200 Parents: 31b6024c65a4480a26866fb60bec54e92038ba5a Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a54de936d028033304f385947fd67d69ae813fc5 Log: Fixed segfault when listing and last line is empty Changed paths: M phpdbg_list.c Diff: diff --git a/phpdbg_list.c b/phpdbg_list.c index 83c27bc..365c7a6 100644 --- a/phpdbg_list.c +++ b/phpdbg_list.c @@ -162,7 +162,7 @@ void phpdbg_list_file(const char *filename, uint count, uint offset, uint highli } } - if (*(buffer + linelen - 1) != '\n') { + if (*(buffer + linelen - 1) != '\n' || !linelen) { phpdbg_out("\n"); } } @@ -265,8 +265,9 @@ zend_op_array *phpdbg_compile_file(zend_file_handle *file, int type TSRMLS_DC) { dataptr->line[++line] = (uint)(bufptr - data.buf) + 1; } } - dataptr = erealloc(dataptr, sizeof(phpdbg_file_source) + sizeof(uint) * line); dataptr->lines = ++line; + dataptr->line[line] = endptr - data.buf; + dataptr = erealloc(dataptr, sizeof(phpdbg_file_source) + sizeof(uint) * line); ret = PHPDBG_G(compile_file)(&fake, type TSRMLS_CC);

« previous php.cvs (#82586) next »