diff options
| author | Felipe Pena <felipe@php.net> | 2011-11-15 15:16:20 +0000 |
|---|---|---|
| committer | Felipe Pena <felipe@php.net> | 2011-11-15 15:16:20 +0000 |
| commit | bb6835f727c070efe94ca808c6b69ae62147f068 (patch) | |
| tree | ea0916ba21fcf928feba5f2693b67e4b68d70fcc /ext/tidy | |
| parent | 7cac52f58fff91a7b258feb8645bc8c52ac19f4a (diff) | |
| download | php-git-bb6835f727c070efe94ca808c6b69ae62147f068.tar.gz | |
- Fixed bug #54682 (Tidy::diagnose() NULL pointer dereference)
Diffstat (limited to 'ext/tidy')
| -rw-r--r-- | ext/tidy/tests/bug54682.phpt | 13 | ||||
| -rw-r--r-- | ext/tidy/tidy.c | 2 |
2 files changed, 14 insertions, 1 deletions
diff --git a/ext/tidy/tests/bug54682.phpt b/ext/tidy/tests/bug54682.phpt new file mode 100644 index 0000000000..99f40cf9d2 --- /dev/null +++ b/ext/tidy/tests/bug54682.phpt @@ -0,0 +1,13 @@ +--TEST-- +Tidy::diagnose() NULL pointer dereference +--SKIPIF-- +<?php if (!extension_loaded("tidy")) print "skip"; ?> +--FILE-- +<?php + +$nx = new Tidy("*"); +$nx->diagnose(); + +?> +--EXPECTF-- +Warning: tidy::__construct(): Cannot Load '*' into memory in %s on line %d diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index a89011db1f..efd5028430 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -1288,7 +1288,7 @@ static PHP_FUNCTION(tidy_diagnose) { TIDY_FETCH_OBJECT; - if (tidyRunDiagnostics(obj->ptdoc->doc) >= 0) { + if (tidyStatus(obj->ptdoc->doc) != 0 && tidyRunDiagnostics(obj->ptdoc->doc) >= 0) { tidy_doc_update_properties(obj TSRMLS_CC); RETURN_TRUE; } |
