handle multiple consecutive character events arising from buffer boundaries, #83

This commit is contained in:
Thomas Fussell 2016-11-20 19:38:58 -05:00
parent 2bfd909684
commit 123d3df982
2 changed files with 6 additions and 16 deletions

View File

@ -982,8 +982,7 @@ void xlsx_consumer::read_shared_string_table()
if (parser().name() == "t") if (parser().name() == "t")
{ {
parser().next_expect(xml::parser::event_type::characters); t.plain_text(read_text());
t.plain_text(parser().value());
} }
else if (parser().name() == "r") // possible multiple text entities. else if (parser().name() == "r") // possible multiple text entities.
{ {
@ -992,9 +991,8 @@ void xlsx_consumer::read_shared_string_table()
if (parser().peek() == xml::parser::event_type::end_element) break; if (parser().peek() == xml::parser::event_type::end_element) break;
parser().next_expect(xml::parser::event_type::start_element, xmlns, "t"); parser().next_expect(xml::parser::event_type::start_element, xmlns, "t");
parser().next_expect(xml::parser::event_type::characters);
text_run run; text_run run;
run.set_string(parser().value()); run.set_string(read_text());
if (parser().peek() == xml::parser::event_type::start_element) if (parser().peek() == xml::parser::event_type::start_element)
{ {
@ -1974,26 +1972,18 @@ void xlsx_consumer::read_worksheet(const std::string &rel_id)
if (parser().qname() == xml::qname(xmlns, "v")) if (parser().qname() == xml::qname(xmlns, "v"))
{ {
has_value = true; has_value = true;
value_string = read_text();
// <v> might be empty, check first
if (parser().peek() == xml::parser::event_type::characters)
{
parser().next_expect(xml::parser::event_type::characters);
value_string = parser().value();
}
} }
else if (parser().qname() == xml::qname(xmlns, "f")) else if (parser().qname() == xml::qname(xmlns, "f"))
{ {
has_formula = true; has_formula = true;
has_shared_formula = parser().attribute_present("t") && parser().attribute("t") == "shared"; has_shared_formula = parser().attribute_present("t") && parser().attribute("t") == "shared";
parser().next_expect(xml::parser::event_type::characters); formula_value_string = read_text();
formula_value_string = parser().value();
} }
else if (parser().qname() == xml::qname(xmlns, "is")) else if (parser().qname() == xml::qname(xmlns, "is"))
{ {
parser().next_expect(xml::parser::event_type::start_element, xmlns, "t"); parser().next_expect(xml::parser::event_type::start_element, xmlns, "t");
parser().next_expect(xml::parser::event_type::characters); value_string = read_text();
value_string = parser().value();
parser().next_expect(xml::parser::event_type::end_element, xmlns, "t"); parser().next_expect(xml::parser::event_type::end_element, xmlns, "t");
} }

2
third-party/botan vendored

@ -1 +1 @@
Subproject commit 523b2a4ca48fa5cf04ea371aabe7167ce2e5cd13 Subproject commit 923a95d546df5b6d31f39b0af900d0361fb2e6a6