summaryrefslogtreecommitdiff
path: root/external/liborcus
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-10-11 21:20:37 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-10-11 21:22:54 +0100
commit50529b713221548d9aa7447d125b734b8de44fa0 (patch)
tree8167b85da896931c29b0152cb16b0cff861a5820 /external/liborcus
parent888535f1c4e8617786c1cb6151aa5ef992b0c30f (diff)
fix crash on examining ooo55043-1.odt etc
Change-Id: I3b57f50b09d491bd1b021eb95587becbd3f169a2
Diffstat (limited to 'external/liborcus')
-rw-r--r--external/liborcus/UnpackedTarball_liborcus.mk1
-rw-r--r--external/liborcus/fix-crash-ooo55043-1.patch.017
2 files changed, 18 insertions, 0 deletions
diff --git a/external/liborcus/UnpackedTarball_liborcus.mk b/external/liborcus/UnpackedTarball_liborcus.mk
index e242cfc42c9f..f2780494bd7f 100644
--- a/external/liborcus/UnpackedTarball_liborcus.mk
+++ b/external/liborcus/UnpackedTarball_liborcus.mk
@@ -16,6 +16,7 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,liborcus,1))
$(eval $(call gb_UnpackedTarball_add_patches,liborcus,\
external/liborcus/0001-workaround-a-linking-problem-on-windows.patch \
external/liborcus/rpath.patch.0 \
+ external/liborcus/fix-crash-ooo55043-1.patch.0 \
))
# vim: set noet sw=4 ts=4:
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.");
+