com php-src: revamp ext/dom: ext/dom/document.c
| From: | Anatol Belski | Date: | Thu, 12 Dec 2013 10:50:45 +0000 |
| Subject: | com php-src: revamp ext/dom: ext/dom/document.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-74404@lists.php.net to get a copy of this message | ||
Commit: bdc565e67ad9cd1f14c987d2e54cd63653ce66a7
Author: Anatol Belski <ab@php.net> Thu, 12 Dec 2013 11:50:45 +0100
Parents: e0c7899dddf0606480ebaf84be6c43d7bd613c58
Branches: str_size_and_int64
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=bdc565e67ad9cd1f14c987d2e54cd63653ce66a7
Log:
revamp ext/dom
Changed paths:
M ext/dom/document.c
Diff:
diff --git a/ext/dom/document.c b/ext/dom/document.c
index 5bacc0f..04027d3 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.c
@@ -419,7 +419,7 @@ int dom_document_standalone_write(dom_object *obj, zval *newval TSRMLS_DC)
{
zval value_copy;
xmlDoc *docp;
- int standalone;
+ php_int_t standalone;
docp = (xmlDocPtr) dom_object_get_node(obj);
@@ -553,7 +553,7 @@ int dom_document_strict_error_checking_write(dom_object *obj, zval *newval TSRML
if (obj->document) {
doc_prop = dom_get_doc_props(obj->document);
- doc_prop->stricterror = Z_LVAL_P(newval);
+ doc_prop->stricterror = Z_BVAL_P(newval);
}
if (newval == &value_copy) {
@@ -596,7 +596,7 @@ int dom_document_format_output_write(dom_object *obj, zval *newval TSRMLS_DC)
if (obj->document) {
doc_prop = dom_get_doc_props(obj->document);
- doc_prop->formatoutput = Z_LVAL_P(newval);
+ doc_prop->formatoutput = Z_BVAL_P(newval);
}
if (newval == &value_copy) {
@@ -638,7 +638,7 @@ int dom_document_validate_on_parse_write(dom_object *obj, zval *newval TSRMLS_DC
if (obj->document) {
doc_prop = dom_get_doc_props(obj->document);
- doc_prop->validateonparse = Z_LVAL_P(newval);
+ doc_prop->validateonparse = Z_BVAL_P(newval);
}
if (newval == &value_copy) {
@@ -680,7 +680,7 @@ int dom_document_resolve_externals_write(dom_object *obj, zval *newval TSRMLS_DC
if (obj->document) {
doc_prop = dom_get_doc_props(obj->document);
- doc_prop->resolveexternals = Z_LVAL_P(newval);
+ doc_prop->resolveexternals = Z_BVAL_P(newval);
}
if (newval == &value_copy) {
@@ -722,7 +722,7 @@ int dom_document_preserve_whitespace_write(dom_object *obj, zval *newval TSRMLS_
if (obj->document) {
doc_prop = dom_get_doc_props(obj->document);
- doc_prop->preservewhitespace = Z_LVAL_P(newval);
+ doc_prop->preservewhitespace = Z_BVAL_P(newval);
}
if (newval == &value_copy) {
@@ -764,7 +764,7 @@ int dom_document_recover_write(dom_object *obj, zval *newval TSRMLS_DC)
if (obj->document) {
doc_prop = dom_get_doc_props(obj->document);
- doc_prop->recover = Z_LVAL_P(newval);
+ doc_prop->recover = Z_BVAL_P(newval);
}
if (newval == &value_copy) {
@@ -806,7 +806,7 @@ int dom_document_substitue_entities_write(dom_object *obj, zval *newval TSRMLS_D
if (obj->document) {
doc_prop = dom_get_doc_props(obj->document);
- doc_prop->substituteentities = Z_LVAL_P(newval);
+ doc_prop->substituteentities = Z_BVAL_P(newval);
}
if (newval == &value_copy) {
@@ -1032,6 +1032,11 @@ PHP_FUNCTION(dom_document_create_cdatasection)
return;
}
+ if (value_len > INT_MAX) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input value is too long");
+ RETURN_FALSE;
+ }
+
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
node = xmlNewCDataBlock(docp, (xmlChar *) value, value_len);
@@ -1562,8 +1567,8 @@ static xmlDocPtr dom_document_parser(zval *id, int mode, char *source, int
sourc
dom_object *intern;
php_libxml_ref_obj *document = NULL;
int validate, recover, resolve_externals, keep_blanks, substitute_ent;
- int resolved_path_len;
- int old_error_reporting = 0;
+ zend_str_size_int resolved_path_len;
+ php_int_t old_error_reporting = 0;
char *directory=NULL, resolved_path[MAXPATHLEN];
if (id != NULL) {