com php-src: Fixed segfault when listing and last line is empty: phpdbg_list.c
| From: | Bob Weinand | Date: | Thu, 09 Oct 2014 10:51:04 +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-82588@lists.php.net to get a copy of this message | ||
Commit: 0bcb32ae47fe308cad008f9ff65c7a998da75d2b
Author: Bob Weinand <bobwei9@hotmail.com> Thu, 9 Oct 2014 12:43:53 +0200
Parents: ca7f2f5f43eda96c098553f6a9e99c2ea6c4d17b
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0bcb32ae47fe308cad008f9ff65c7a998da75d2b
Log:
Fixed segfault when listing and last line is empty
Conflicts:
phpdbg_list.c
Changed paths:
M phpdbg_list.c
Diff:
diff --git a/phpdbg_list.c b/phpdbg_list.c
index 6a53b8d..5ea3a3e 100644
--- a/phpdbg_list.c
+++ b/phpdbg_list.c
@@ -158,6 +158,10 @@ void phpdbg_list_file(const char *filename, uint count, uint offset, uint
highli
phpdbg_write(">%05u: %.*s", line, linelen, buffer);
}
}
+
+ if (*(buffer + linelen - 1) != '\n' || !linelen) {
+ phpdbg_writeln(EMPTY);
+ }
}
} /* }}} */
@@ -256,8 +260,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);