summaryrefslogtreecommitdiff
path: root/external/liborcus/fix-crash-ooo55043-1.patch.0
diff options
context:
space:
mode:
Diffstat (limited to 'external/liborcus/fix-crash-ooo55043-1.patch.0')
-rw-r--r--external/liborcus/fix-crash-ooo55043-1.patch.017
1 files changed, 17 insertions, 0 deletions
diff --git a/external/liborcus/fix-crash-ooo55043-1.patch.0 b/external/liborcus/fix-crash-ooo55043-1.patch.0
new file mode 100644
index 000000000000..58a97c04424d
--- /dev/null
+++ b/external/liborcus/fix-crash-ooo55043-1.patch.0
@@ -0,0 +1,17 @@
+--- src/parser/zip_archive_stream.cpp
++++ src/parser/zip_archive_stream.cpp
+@@ -91,8 +91,13 @@
+
+ void zip_archive_stream_blob::read(unsigned char* buffer, size_t length) const
+ {
++ if (!length)
++ return;
+ // First, make sure we have enough blob to satisfy the requested stream length.
+- size_t length_available = m_size - tell();
++ const size_t pos = tell();
++ if (pos > m_size)
++ throw zip_error("Stream is seeked past end. No data available");
++ const size_t length_available = m_size - pos;
+ if (length_available < length)
+ throw zip_error("There is not enough stream left to fill requested length.");
+