com php-src: more range checks for ext/tidy: ext/tidy/tidy.c

From: Date: Tue, 10 Dec 2013 12:41:49 +0000
Subject: com php-src: more range checks for ext/tidy: ext/tidy/tidy.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-74334@lists.php.net to get a copy of this message
Commit: a697297f5f328442994c6321c9661d1351036c4e Author: Anatol Belski <ab@php.net> Tue, 10 Dec 2013 13:41:49 +0100 Parents: 5acc0c0c5bf5afbd2b103a99adf51539874ccc48 Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a697297f5f328442994c6321c9661d1351036c4e Log: more range checks for ext/tidy Changed paths: M ext/tidy/tidy.c Diff: diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index 94daef4..69cd19e 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -604,6 +604,11 @@ static void php_tidy_quick_repair(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_fil if (data) { TidyBuffer buf; + if (data_len > UINT_MAX) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input data is too long"); + RETVAL_FALSE; + } + tidyBufInit(&buf); tidyBufAttach(&buf, (byte *) data, data_len); @@ -1043,6 +1048,11 @@ static int php_tidy_parse_string(PHPTidyObj *obj, char *string, zend_str_size_in { TidyBuffer buf; + if (len > UINT_MAX) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input string is too long"); + return FAILURE; + } + if(enc) { if (tidySetCharEncoding(obj->ptdoc->doc, enc) < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not set encoding '%s'", enc);

« previous php.cvs (#74334) next »