diff options
Diffstat (limited to 'Swiften/Parser/ExpatParser.cpp')
| -rw-r--r-- | Swiften/Parser/ExpatParser.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Swiften/Parser/ExpatParser.cpp b/Swiften/Parser/ExpatParser.cpp index 77d959c..8415c42 100644 --- a/Swiften/Parser/ExpatParser.cpp +++ b/Swiften/Parser/ExpatParser.cpp | |||
| @@ -7,13 +7,12 @@ | |||
| 7 | #include <Swiften/Parser/ExpatParser.h> | 7 | #include <Swiften/Parser/ExpatParser.h> |
| 8 | 8 | ||
| 9 | #include <cassert> | 9 | #include <cassert> |
| 10 | #include <limits> | ||
| 10 | #include <memory> | 11 | #include <memory> |
| 11 | #include <string> | 12 | #include <string> |
| 12 | 13 | ||
| 13 | #include <expat.h> | 14 | #include <expat.h> |
| 14 | 15 | ||
| 15 | #include <boost/numeric/conversion/cast.hpp> | ||
| 16 | |||
| 17 | #include <Swiften/Base/String.h> | 16 | #include <Swiften/Base/String.h> |
| 18 | #include <Swiften/Parser/XMLParserClient.h> | 17 | #include <Swiften/Parser/XMLParserClient.h> |
| 19 | 18 | ||
| @@ -84,7 +83,10 @@ ExpatParser::~ExpatParser() { | |||
| 84 | } | 83 | } |
| 85 | 84 | ||
| 86 | bool ExpatParser::parse(const std::string& data) { | 85 | bool ExpatParser::parse(const std::string& data) { |
| 87 | bool success = XML_Parse(p->parser_, data.c_str(), boost::numeric_cast<int>(data.size()), false) == XML_STATUS_OK; | 86 | if (data.size() > std::numeric_limits<int>::max()) { |
| 87 | return false; | ||
| 88 | } | ||
| 89 | bool success = XML_Parse(p->parser_, data.c_str(), static_cast<int>(data.size()), false) == XML_STATUS_OK; | ||
| 88 | /*if (!success) { | 90 | /*if (!success) { |
| 89 | std::cout << "ERROR: " << XML_ErrorString(XML_GetErrorCode(p->parser_)) << " while parsing " << data << std::endl; | 91 | std::cout << "ERROR: " << XML_ErrorString(XML_GetErrorCode(p->parser_)) << " while parsing " << data << std::endl; |
| 90 | }*/ | 92 | }*/ |
Swift