diff options
author | Michael Stahl <mstahl@redhat.com> | 2013-06-18 00:57:02 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2013-06-20 00:34:04 +0200 |
commit | e3e2cf30373446e5511b12467e3b8008311c81c2 (patch) | |
tree | 8fdd06e10be43e7f9cf7403e4d6fa9d56d8773fb /libmwaw | |
parent | 7694bb997a68f6f8ebc03817be7e31ceb872ceb4 (diff) |
libmwaw: fix infinite loop in findCentralDirectoryEnd
Change-Id: I36ec7ad735fa15cfda88167b11a922883ef2bb72
Diffstat (limited to 'libmwaw')
-rw-r--r-- | libmwaw/UnpackedTarball_libmwaw.mk | 1 | ||||
-rw-r--r-- | libmwaw/libmwaw-infinite-loop.patch.1 | 32 |
2 files changed, 33 insertions, 0 deletions
diff --git a/libmwaw/UnpackedTarball_libmwaw.mk b/libmwaw/UnpackedTarball_libmwaw.mk index 8e3be68d7e96..a17961d7d2bf 100644 --- a/libmwaw/UnpackedTarball_libmwaw.mk +++ b/libmwaw/UnpackedTarball_libmwaw.mk @@ -13,6 +13,7 @@ $(eval $(call gb_UnpackedTarball_set_tarball,libmwaw,$(MWAW_TARBALL))) $(eval $(call gb_UnpackedTarball_add_patches,libmwaw,\ libmwaw/libmwaw-0.1.9.patch.1 \ + libmwaw/libmwaw-infinite-loop.patch.1 \ )) # vim: set noet sw=4 ts=4: diff --git a/libmwaw/libmwaw-infinite-loop.patch.1 b/libmwaw/libmwaw-infinite-loop.patch.1 new file mode 100644 index 000000000000..9c8e3a8b413e --- /dev/null +++ b/libmwaw/libmwaw-infinite-loop.patch.1 @@ -0,0 +1,32 @@ +fix infinite loop in findCentralDirectoryEnd + +WPXSvInputStreamImpl::seek returns -1 if it catches an exception + +--- libmwaw/src/lib/MWAWZipStream.cxx 2013-06-18 00:37:57.208657845 +0200 ++++ libmwaw/src/lib/MWAWZipStream.cxx 2013-06-18 00:48:20.971665257 +0200 +@@ -258,18 +258,20 @@ + + static bool findCentralDirectoryEnd(WPXInputStream *input) + { +- input->seek(0, WPX_SEEK_SET); ++ // seek returns -1 both on error and on seek to position post-the-end ++ int ret = input->seek(0, WPX_SEEK_SET); + try { +- while (!input->atEOS()) +- input->seek(1024, WPX_SEEK_CUR); ++ while (-1 != ret && !input->atEOS()) ++ ret = input->seek(1024, WPX_SEEK_CUR); + input->seek(-1024, WPX_SEEK_CUR); +- while (!input->atEOS()) { ++ ret = 0; // perhaps it's smaller than 1024? ++ while (-1 != ret && !input->atEOS()) { + unsigned signature = getInt(input); + if (signature == CDIR_END_SIG) { + input->seek(-4, WPX_SEEK_CUR); + return true; + } else +- input->seek(-3, WPX_SEEK_CUR); ++ ret = input->seek(-3, WPX_SEEK_CUR); + } + } catch (...) { + return false; |