summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRupinder Singh Khokhar <rsk1coder99@gmail.com>2014-07-18 12:44:03 (GMT)
committer Rupinder Singh Khokhar <rsk1coder99@gmail.com>2014-08-01 16:14:34 (GMT)
commit0892c102cffbb918187a9c0d1d94ee0cc037a0b7 (patch)
treeb65400d130f13eccd967bf5004cf3e9e46534727
parentcef912a36f581deefa3674d1bd988beb9473acbb (diff)
downloadlibhubbub-0892c102cffbb918187a9c0d1d94ee0cc037a0b7.tar.gz
libhubbub-0892c102cffbb918187a9c0d1d94ee0cc037a0b7.tar.bz2
Fixed a bug in cdata block tokenisation. Also fixed handling of br close tag in body
-rw-r--r--src/tokeniser/tokeniser.c11
-rw-r--r--src/treebuilder/in_body.c4
2 files changed, 9 insertions, 6 deletions
diff --git a/src/tokeniser/tokeniser.c b/src/tokeniser/tokeniser.c
index 500a88d..66c36d5 100644
--- a/src/tokeniser/tokeniser.c
+++ b/src/tokeniser/tokeniser.c
@@ -3255,7 +3255,7 @@ hubbub_error hubbub_tokeniser_handle_cdata_block(hubbub_tokeniser *tokeniser)
if (error != PARSERUTILS_OK) {
if (error == PARSERUTILS_EOF) {
tokeniser->state = STATE_DATA;
- return emit_current_chars(tokeniser);
+ return HUBBUB_OK;
} else {
return hubbub_error_from_parserutils_error(error);
}
@@ -3263,17 +3263,18 @@ hubbub_error hubbub_tokeniser_handle_cdata_block(hubbub_tokeniser *tokeniser)
c = *cptr;
- if (c == ']' && (tokeniser->context.match_cdata.end == 0 ||
- tokeniser->context.match_cdata.end == 1)) {
+ if (c == ']' && (tokeniser->context.match_cdata.end >= 0)) {
tokeniser->context.pending += len;
tokeniser->context.match_cdata.end += len;
- } else if (c == '>' && tokeniser->context.match_cdata.end == 2) {
+ } else if (c == '>' && tokeniser->context.match_cdata.end >= 2) {
/* Remove the previous two "]]" */
tokeniser->context.pending -= 2;
tokeniser->context.match_cdata.end = 0;
/* Emit any pending characters */
- emit_current_chars(tokeniser);
+ if(tokeniser->context.pending > 0) {
+ emit_current_chars(tokeniser);
+ }
/* Now move past the "]]>" bit */
parserutils_inputstream_advance(tokeniser->input, SLEN("]]>"));
diff --git a/src/treebuilder/in_body.c b/src/treebuilder/in_body.c
index 33b563e..bd73f08 100644
--- a/src/treebuilder/in_body.c
+++ b/src/treebuilder/in_body.c
@@ -1187,7 +1187,7 @@ hubbub_error process_hr_in_body(hubbub_treebuilder *treebuilder,
hubbub_error err;
if (element_in_scope(treebuilder, P, BUTTON_SCOPE)) {
- err = process_0p_in_body(treebuilder);
+ err = close_p_in_body(treebuilder);
if (err != HUBBUB_OK)
return err;
}
@@ -2522,6 +2522,8 @@ hubbub_error process_0br_in_body(hubbub_treebuilder *treebuilder)
if (err != HUBBUB_OK)
return err;
+ treebuilder->context.frameset_ok = false;
+
return insert_element(treebuilder, &tag, false);
}