diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
commit | ed5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch) | |
tree | 7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /external/liborcus/overrun.patch.0 | |
parent | Initial commit. (diff) | |
download | libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip |
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | external/liborcus/overrun.patch.0 | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/external/liborcus/overrun.patch.0 b/external/liborcus/overrun.patch.0 new file mode 100644 index 000000000..de2097e32 --- /dev/null +++ b/external/liborcus/overrun.patch.0 @@ -0,0 +1,63 @@ +--- src/parser/sax_token_parser.cpp ++++ src/parser/sax_token_parser.cpp +@@ -10,6 +10,7 @@ + + #include <mdds/sorted_string_map.hpp> + #include <cctype> ++#include <limits> + + namespace orcus { + +@@ -329,6 +330,28 @@ + m_elem.raw_name = elem.name; + } + ++static uint8_t readUint8(char const * begin, char const * end, char const ** endptr) { ++ unsigned n = 0; ++ char const * p = begin; ++ for (; p != end; ++p) { ++ char const c = *p; ++ if (c < '0' || c > '9') { ++ break; ++ } ++ n = 10 * n + (c - '0'); ++ if (n > std::numeric_limits<uint8_t>::max()) { ++ *endptr = nullptr; ++ return 0; ++ } ++ } ++ if (p == begin) { ++ *endptr = nullptr; ++ return 0; ++ } ++ *endptr = p; ++ return n; ++} ++ + void sax_token_handler_wrapper_base::attribute(std::string_view name, std::string_view val) + { + decl_attr_type dat = decl_attr::get().find(name.data(), name.size()); +@@ -340,18 +362,18 @@ + const char* p = val.data(); + const char* p_end = p + val.size(); + +- char* endptr = nullptr; +- long v = std::strtol(p, &endptr, 10); ++ const char* endptr = nullptr; ++ uint8_t v = readUint8(p, p_end, &endptr); + +- if (!endptr || endptr >= p_end || *endptr != '.') ++ if (!endptr || endptr == p_end || *endptr != '.') + break; + + m_declaration.version_major = v; + p = endptr + 1; + +- v = std::strtol(p, &endptr, 10); ++ v = readUint8(p, p_end, &endptr); + +- if (!endptr || endptr > p_end) ++ if (!endptr) + break; + + m_declaration.version_minor = v; |