diff options
| author | Nuno Lopes <nlopess@php.net> | 2008-04-04 15:01:23 +0000 |
|---|---|---|
| committer | Nuno Lopes <nlopess@php.net> | 2008-04-04 15:01:23 +0000 |
| commit | bfcdbbcd33a3011aa9bc681433017999a2ce5fe7 (patch) | |
| tree | 3d9084f147d7d52de6a1c2cc4358df8c8baea48b /Zend/zend_language_scanner.l | |
| parent | c3474b91163118f69d24d2859d7c3ff07460e992 (diff) | |
| download | php-git-bfcdbbcd33a3011aa9bc681433017999a2ce5fe7.tar.gz | |
add sanity checks for ZEND_MMAP_AHEAD and reduce the value from 32 to 16 (lowest safe value)
Diffstat (limited to 'Zend/zend_language_scanner.l')
| -rw-r--r-- | Zend/zend_language_scanner.l | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index be2be3694c..182538dc1f 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -66,6 +66,13 @@ #define yyless(x) YYCURSOR = yytext + x #define yymore() goto yymore_restart +/* perform sanity check. If this message is triggered you should + increase the ZEND_MMAP_AHEAD value in the zend_streams.h file */ +/*!max:re2c */ +#if ZEND_MMAP_AHEAD < YYMAXFILL +# error ZEND_MMAP_AHEAD should be greater than or equal to YYMAXFILL +#endif + #ifdef HAVE_STDARG_H # include <stdarg.h> #endif @@ -356,9 +363,9 @@ zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC) ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_DC) { /* enforce two trailing NULLs for flex... */ - STR_REALLOC(str->value.str.val, str->value.str.len+2); + str->value.str.val = safe_erealloc(str->value.str.val, 1, str->value.str.len, ZEND_MMAP_AHEAD); - str->value.str.val[str->value.str.len+1]=0; + memset(str->value.str.val + str->value.str.len, 0, ZEND_MMAP_AHEAD); SCNG(yy_in)=NULL; |
