diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-09-11 09:32:11 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2013-09-11 17:47:15 +0000 |
commit | c0cf51a499ec52b23443393b67425ab557328a9a (patch) | |
tree | c9aac089e253d4dcea0757fe2a6580bd338ddbbd | |
parent | 9c2b278f3d46e85697ae95ca54b4c552d964a33a (diff) |
CID#736212 clip word 2 pap bounds
and add a unit test for the word 2..5 formats
(cherry picked from commit 5d8a9d56de7c1217cfdbe2288c1a3a9128c3dbb5)
Conflicts:
sw/qa/core/filters-test.cxx
Change-Id: I6c7c26be6092acbb81282080de6c393d92ad5dd4
Reviewed-on: https://gerrit.libreoffice.org/5912
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | sw/qa/core/data/ww5/fail/.gitignore | 0 | ||||
-rw-r--r-- | sw/qa/core/data/ww5/indeterminate/.gitignore | 0 | ||||
-rw-r--r-- | sw/qa/core/data/ww5/pass/.gitignore | 0 | ||||
-rw-r--r-- | sw/qa/core/data/ww5/pass/ooo2535-1.doc | bin | 0 -> 55056 bytes | |||
-rw-r--r-- | sw/qa/core/filters-test.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8scan.cxx | 10 |
6 files changed, 13 insertions, 1 deletions
diff --git a/sw/qa/core/data/ww5/fail/.gitignore b/sw/qa/core/data/ww5/fail/.gitignore new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/sw/qa/core/data/ww5/fail/.gitignore diff --git a/sw/qa/core/data/ww5/indeterminate/.gitignore b/sw/qa/core/data/ww5/indeterminate/.gitignore new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/sw/qa/core/data/ww5/indeterminate/.gitignore diff --git a/sw/qa/core/data/ww5/pass/.gitignore b/sw/qa/core/data/ww5/pass/.gitignore new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/sw/qa/core/data/ww5/pass/.gitignore diff --git a/sw/qa/core/data/ww5/pass/ooo2535-1.doc b/sw/qa/core/data/ww5/pass/ooo2535-1.doc Binary files differnew file mode 100644 index 000000000000..2c594f562347 --- /dev/null +++ b/sw/qa/core/data/ww5/pass/ooo2535-1.doc diff --git a/sw/qa/core/filters-test.cxx b/sw/qa/core/filters-test.cxx index 9905b2350181..e54cec588c6f 100644 --- a/sw/qa/core/filters-test.cxx +++ b/sw/qa/core/filters-test.cxx @@ -124,6 +124,10 @@ void SwFiltersTest::testCVEs() getURLFromSrc("/sw/qa/core/data/ww8/"), rtl::OUString(FILTER_WW8)); + testDir(rtl::OUString("MS WinWord 5"), + getURLFromSrc("/sw/qa/core/data/ww5/"), + rtl::OUString(sWW5)); + testDir(rtl::OUString("Text (encoded)"), getURLFromSrc("/sw/qa/core/data/txt/"), rtl::OUString(FILTER_TEXT_DLG)); diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index e9ef6f85e0fe..3b0acb53e99c 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -2521,7 +2521,15 @@ WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(ww::WordVersion eVersion, SvStream* pSt, { aEntry.mnLen-=6; //PHE //skipi stc, len byte + 6 byte PHE - aEntry.mpData = maRawData + nOfs + 8; + unsigned int nOffset = nOfs + 8; + if (nOffset >= 511) //Bad offset + aEntry.mnLen=0; + if (aEntry.mnLen) //start is ok + { + if (nOffset + aEntry.mnLen > 512) //Bad end, clip + aEntry.mnLen = 512 - nOffset; + aEntry.mpData = maRawData + nOffset; + } } else aEntry.mnLen=0; //Too short |