summaryrefslogtreecommitdiff
path: root/external/libwps
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2019-10-01 17:58:35 +0200
committerEike Rathke <erack@redhat.com>2019-10-02 11:23:03 +0200
commit5a7d4ee6c4dd92758e0fd213671251e96d6e7f08 (patch)
tree501faee1accfc9dcd999f68df3e18517531c3246 /external/libwps
parentb3b8288f7f6c3cbb36edac2eddf0fff974c6d04a (diff)
Resolves: tdf#127887 Fix libwps wrong Lotus version detection
Also return the proper kind and creator values set in WKS4Parser::checkHeader() to callers of WPSDocument::isFileFormatSupported() Change-Id: I3adfde0e18669b80956a9b577080fe8388dd3b1f Reviewed-on: https://gerrit.libreoffice.org/79981 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'external/libwps')
-rw-r--r--external/libwps/UnpackedTarball_libwps.mk1
-rw-r--r--external/libwps/libwps-lotus-version-tdf127887.patch.144
2 files changed, 45 insertions, 0 deletions
diff --git a/external/libwps/UnpackedTarball_libwps.mk b/external/libwps/UnpackedTarball_libwps.mk
index f53a8fffc429..d0855de0ef99 100644
--- a/external/libwps/UnpackedTarball_libwps.mk
+++ b/external/libwps/UnpackedTarball_libwps.mk
@@ -24,6 +24,7 @@ ifneq ($(OS),MACOSX)
ifneq ($(OS),WNT)
$(eval $(call gb_UnpackedTarball_add_patches,libwps,\
external/libwps/libwps-bundled-soname.patch.0 \
+ external/libwps/libwps-lotus-version-tdf127887.patch.1 \
))
endif
endif
diff --git a/external/libwps/libwps-lotus-version-tdf127887.patch.1 b/external/libwps/libwps-lotus-version-tdf127887.patch.1
new file mode 100644
index 000000000000..3427ef1f0813
--- /dev/null
+++ b/external/libwps/libwps-lotus-version-tdf127887.patch.1
@@ -0,0 +1,44 @@
+diff -ur libwps.org/src/lib/WKS4.cpp libwps/src/lib/WKS4.cpp
+--- libwps.org/src/lib/WKS4.cpp 2018-08-06 10:51:12.000000000 +0200
++++ libwps/src/lib/WKS4.cpp 2019-10-01 17:28:59.497500545 +0200
+@@ -477,7 +477,7 @@
+ }
+ else if (val==0x406)
+ {
+- m_state->m_version=1;
++ m_state->m_version=2;
+ f << "lotus,";
+ creatorId=libwps::WPS_LOTUS;
+ }
+@@ -830,14 +830,15 @@
+ isParsed = true;
+ break;
+ case 0x2f: // iteration count: only in dos file Wk1, Wks(dos), Wq[12] ?
++ // Maybe, but that does not mean it would not be used
++ // in Lotus version 2 files (that are also .WK1), so do
++ // not reset an already detected version here.
+ if (sz!=1) break;
+ input->seek(pos+4, librevenge::RVNG_SEEK_SET);
+ f.str("");
+ val=int(libwps::readU8(input));
+ f << "Entries(ItCount):dos";
+ if (val!=1) f << "=" << val << ",";
+- if (m_state->m_version==2)
+- m_state->m_version=1;
+ isParsed = needWriteInAscii = true;
+ break;
+ case 0x41: // graph record name
+diff -ur libwps.org/src/lib/WPSDocument.cpp libwps/src/lib/WPSDocument.cpp
+--- libwps.org/src/lib/WPSDocument.cpp 2018-08-02 12:12:26.000000000 +0200
++++ libwps/src/lib/WPSDocument.cpp 2019-10-01 16:00:41.172596186 +0200
+@@ -155,6 +155,10 @@
+ WKS4Parser parser(header->getInput(), header);
+ if (!parser.checkHeader(header.get(), true))
+ return WPS_CONFIDENCE_NONE;
++ // checkHeader() may set new kind and creator values,
++ // pass them up to caller.
++ kind = header->getKind();
++ creator = header->getCreator();
+ needEncoding=header->getNeedEncoding();
+ return header->getIsEncrypted() ? WPS_CONFIDENCE_SUPPORTED_ENCRYPTION : WPS_CONFIDENCE_EXCELLENT;
+ }