diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-08-13 14:28:11 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-08-14 09:30:22 +0200 |
commit | 8a34b8cba94dca9c4d5e30b84848957115cf8e6d (patch) | |
tree | 156ba953be7f39966ce79db7ed03f88083c65e1f /lotuswordpro | |
parent | 43c1a3a904e889e4b8660fa28d4f4479c0f267ae (diff) |
LwpPageLayout::GetPageNumber returns sal_Int32
...so assume this code (esp. the following nPageNumber>0 check) wants to
actually use sal_Int32 rather than wrap-around (cf. the subtraction of 1)
sal_uInt16. (The code was like that ever since its introduction with
cc316b39d9110c536e1758a4f814738ca209bb02 "Port of Lotus Word Pro filter, by Fong
Lin and Noel Power".)
Found with new Clang -fsanitize=implicit-conversion during
CppunitTest_lotuswordpro_test_lotuswordpro:
> lotuswordpro/source/filter/lwppagelayout.cxx:447:23: runtime error: implicit conversion from type 'int' of value -2 (32-bit, signed) to type 'sal_uInt16' (aka 'unsigned short') changed the value to 65534 (16-bit, unsigned)
> #0 in LwpPageLayout::HasFillerPageText(LwpFoundry const*) at lotuswordpro/source/filter/lwppagelayout.cxx:447:23 (instdir/program/liblwpftlo.so +0xa23859)
> #1 in LwpMasterPage::RegisterFillerPageStyle() at lotuswordpro/source/filter/lwpfribsection.cxx:434:23 (instdir/program/liblwpftlo.so +0x9051e4)
> #2 in LwpMasterPage::RegisterMasterPage(LwpFrib*) at lotuswordpro/source/filter/lwpfribsection.cxx:288:17 (instdir/program/liblwpftlo.so +0x8fd614)
> #3 in LwpFribPageBreak::RegisterBreakStyle(LwpPara*) at lotuswordpro/source/filter/lwpfribbreaks.cxx:125:24 (instdir/program/liblwpftlo.so +0x890392)
> #4 in LwpFribPtr::RegisterStyle() at lotuswordpro/source/filter/lwpfribptr.cxx:440:24 (instdir/program/liblwpftlo.so +0x8f4ef9)
> #5 in LwpPara::RegisterStyle() at lotuswordpro/source/filter/lwppara.cxx:684:13 (instdir/program/liblwpftlo.so +0xa7267f)
> #6 in LwpObject::DoRegisterStyle() at lotuswordpro/inc/lwpobj.hxx:109:9 (instdir/program/liblwpftlo.so +0x7001ea)
> #7 in LwpStory::RegisterStyle() at lotuswordpro/source/filter/lwpstory.cxx:146:16 (instdir/program/liblwpftlo.so +0xae61cf)
> #8 in LwpObject::DoRegisterStyle() at lotuswordpro/inc/lwpobj.hxx:109:9 (instdir/program/liblwpftlo.so +0x7001ea)
> #9 in LwpFooterLayout::RegisterStyle(XFMasterPage*) at lotuswordpro/source/filter/lwppagelayout.cxx:1042:17 (instdir/program/liblwpftlo.so +0xa1f491)
> #10 in LwpPageLayout::RegisterStyle() at lotuswordpro/source/filter/lwppagelayout.cxx:354:24 (instdir/program/liblwpftlo.so +0xa1d717)
> #11 in LwpObject::DoRegisterStyle() at lotuswordpro/inc/lwpobj.hxx:109:9 (instdir/program/liblwpftlo.so +0x7001ea)
> #12 in LwpHeadLayout::RegisterStyle() at lotuswordpro/source/filter/lwplayout.cxx:520:22 (instdir/program/liblwpftlo.so +0x96e987)
> #13 in LwpObject::DoRegisterStyle() at lotuswordpro/inc/lwpobj.hxx:109:9 (instdir/program/liblwpftlo.so +0x7001ea)
> #14 in LwpHeadLayout::RegisterStyle() at lotuswordpro/source/filter/lwplayout.cxx:520:22 (instdir/program/liblwpftlo.so +0x96e987)
> #15 in LwpObject::DoRegisterStyle() at lotuswordpro/inc/lwpobj.hxx:109:9 (instdir/program/liblwpftlo.so +0x7001ea)
> #16 in LwpFoundry::RegisterAllLayouts() at lotuswordpro/source/filter/lwpfoundry.cxx:182:17 (instdir/program/liblwpftlo.so +0x852894)
> #17 in LwpDocument::RegisterLayoutStyles() at lotuswordpro/source/filter/lwpdoc.cxx:257:26 (instdir/program/liblwpftlo.so +0x7980b9)
> #18 in LwpDocument::RegisterStyle() at lotuswordpro/source/filter/lwpdoc.cxx:212:5 (instdir/program/liblwpftlo.so +0x795056)
> #19 in LwpObject::DoRegisterStyle() at lotuswordpro/inc/lwpobj.hxx:109:9 (instdir/program/liblwpftlo.so +0x7001ea)
> #20 in LwpDocSock::RegisterStyle() at lotuswordpro/source/filter/lwpdoc.cxx:807:15 (instdir/program/liblwpftlo.so +0x7a36cf)
> #21 in LwpObject::DoRegisterStyle() at lotuswordpro/inc/lwpobj.hxx:109:9 (instdir/program/liblwpftlo.so +0x7001ea)
> #22 in LwpDocument::RegisterStyle() at lotuswordpro/source/filter/lwpdoc.cxx:222:19 (instdir/program/liblwpftlo.so +0x7953d4)
> #23 in LwpObject::DoRegisterStyle() at lotuswordpro/inc/lwpobj.hxx:109:9 (instdir/program/liblwpftlo.so +0x7001ea)
> #24 in Lwp9Reader::ParseDocument() at lotuswordpro/source/filter/lwp9reader.cxx:154:10 (instdir/program/liblwpftlo.so +0x6f4c77)
> #25 in Lwp9Reader::Read() at lotuswordpro/source/filter/lwp9reader.cxx:90:20 (instdir/program/liblwpftlo.so +0x6f3f2c)
> #26 in ReadWordproFile(SvStream&, com::sun::star::uno::Reference<com::sun::star::xml::sax::XDocumentHandler> const&) at lotuswordpro/source/filter/lwpfilter.cxx:215:33 (instdir/program/liblwpftlo.so +0x82436d)
> #27 in LotusWordProImportFilter::importImpl(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at lotuswordpro/source/filter/LotusWordProImportFilter.cxx:75:14 (instdir/program/liblwpftlo.so +0x6e4a3a)
> #28 in LotusWordProImportFilter::filter(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at lotuswordpro/source/filter/LotusWordProImportFilter.cxx:87:12 (instdir/program/liblwpftlo.so +0x6e4cfa)
> #29 in (anonymous namespace)::LotusWordProTest::load(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int) at lotuswordpro/qa/cppunit/test_lotuswordpro.cxx:59:27 (workdir/LinkTarget/CppunitTest/libtest_lotuswordpro_test_lotuswordpro.so +0x14a52)
> #30 in test::FiltersTest::recursiveScan(test::filterStatus, rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int, bool) at unotest/source/cpp/filters-test.cxx:130:20 (workdir/LinkTarget/CppunitTest/../Library/libunotest.so +0x5724c)
> #31 in test::FiltersTest::testDir(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int, bool) at unotest/source/cpp/filters-test.cxx:158:5 (workdir/LinkTarget/CppunitTest/../Library/libunotest.so +0x580e7)
> #32 in (anonymous namespace)::LotusWordProTest::test() at lotuswordpro/qa/cppunit/test_lotuswordpro.cxx:64:9 (workdir/LinkTarget/CppunitTest/libtest_lotuswordpro_test_lotuswordpro.so +0x153d4)
> #33 in void std::__invoke_impl<void, void ((anonymous namespace)::LotusWordProTest::*&)(), (anonymous namespace)::LotusWordProTest*&>(std::__invoke_memfun_deref, void ((anonymous namespace)::LotusWordProTest::*&)(), (anonymous namespace)::LotusWordProTest*&) at /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/bits/invoke.h:73:14 (workdir/LinkTarget/CppunitTest/libtest_lotuswordpro_test_lotuswordpro.so +0x17fcd)
> #34 in std::__invoke_result<void ((anonymous namespace)::LotusWordProTest::*&)(), (anonymous namespace)::LotusWordProTest*&>::type std::__invoke<void ((anonymous namespace)::LotusWordProTest::*&)(), (anonymous namespace)::LotusWordProTest*&>(void ((anonymous namespace)::LotusWordProTest::*&)(), (anonymous namespace)::LotusWordProTest*&) at /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/bits/invoke.h:95:14 (workdir/LinkTarget/CppunitTest/libtest_lotuswordpro_test_lotuswordpro.so +0x17c6b)
> #35 in void std::_Bind<void ((anonymous namespace)::LotusWordProTest::* ((anonymous namespace)::LotusWordProTest*))()>::__call<void, 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) at /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/functional:400:11 (workdir/LinkTarget/CppunitTest/libtest_lotuswordpro_test_lotuswordpro.so +0x17b28)
> #36 in void std::_Bind<void ((anonymous namespace)::LotusWordProTest::* ((anonymous namespace)::LotusWordProTest*))()>::operator()<void>() at /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/functional:482:17 (workdir/LinkTarget/CppunitTest/libtest_lotuswordpro_test_lotuswordpro.so +0x178e5)
> #37 in std::_Function_handler<void (), std::_Bind<void ((anonymous namespace)::LotusWordProTest::* ((anonymous namespace)::LotusWordProTest*))()> >::_M_invoke(std::_Any_data const&) at /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/bits/std_function.h:297:2 (workdir/LinkTarget/CppunitTest/libtest_lotuswordpro_test_lotuswordpro.so +0x16bc6)
> #38 in std::function<void ()>::operator()() const at /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/bits/std_function.h:687:14 (workdir/LinkTarget/CppunitTest/libtest_lotuswordpro_test_lotuswordpro.so +0x23276)
> #39 in CppUnit::TestCaller<(anonymous namespace)::LotusWordProTest>::runTest() at workdir/UnpackedTarball/cppunit/include/cppunit/TestCaller.h:175:7 (workdir/LinkTarget/CppunitTest/libtest_lotuswordpro_test_lotuswordpro.so +0x160c6)
> #40 in CppUnit::TestCaseMethodFunctor::operator()() const at workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:32:5 (workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.14.so.0 +0x22c1f1)
> #41 in (anonymous namespace)::Protector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) at test/source/vclbootstrapprotector.cxx:49:14 (workdir/LinkTarget/Library/libvclbootstrapprotector.so +0x159a)
> #42 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const at workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25 (workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.14.so.0 +0x20e64d)
> #43 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) at unotest/source/cpp/unobootstrapprotector/unobootstrapprotector.cxx:88:12 (workdir/LinkTarget/Library/unobootstrapprotector.so +0x987a)
> #44 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const at workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25 (workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.14.so.0 +0x20e64d)
> #45 in (anonymous namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) at unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx:63:16 (workdir/LinkTarget/Library/unoexceptionprotector.so +0x5000)
> #46 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const at workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25 (workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.14.so.0 +0x20e64d)
> #47 in CppUnit::DefaultProtector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) at workdir/UnpackedTarball/cppunit/src/cppunit/DefaultProtector.cpp:15:12 (workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.14.so.0 +0x1c6c51)
> #48 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const at workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25 (workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.14.so.0 +0x20e64d)
> #49 in CppUnit::ProtectorChain::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) at workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:86:18 (workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.14.so.0 +0x2096b8)
> #50 in CppUnit::TestResult::protect(CppUnit::Functor const&, CppUnit::Test*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) at workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:182:28 (workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.14.so.0 +0x26c3e4)
> #51 in CppUnit::TestCase::run(CppUnit::TestResult*) at workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:91:13 (workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.14.so.0 +0x22b1fb)
> #52 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) at workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30 (workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.14.so.0 +0x22db43)
> #53 in CppUnit::TestComposite::run(CppUnit::TestResult*) at workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3 (workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.14.so.0 +0x22d119)
> #54 in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*) at workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:64:30 (workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.14.so.0 +0x22db43)
> #55 in CppUnit::TestComposite::run(CppUnit::TestResult*) at workdir/UnpackedTarball/cppunit/src/cppunit/TestComposite.cpp:23:3 (workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.14.so.0 +0x22d119)
> #56 in CppUnit::TestRunner::WrappingSuite::run(CppUnit::TestResult*) at workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:47:27 (workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.14.so.0 +0x28b6c2)
> #57 in CppUnit::TestResult::runTest(CppUnit::Test*) at workdir/UnpackedTarball/cppunit/src/cppunit/TestResult.cpp:149:9 (workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.14.so.0 +0x26b715)
> #58 in CppUnit::TestRunner::run(CppUnit::TestResult&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) at workdir/UnpackedTarball/cppunit/src/cppunit/TestRunner.cpp:96:14 (workdir/UnpackedTarball/cppunit/src/cppunit/.libs/libcppunit-1.14.so.0 +0x28c103)
> #59 in (anonymous namespace)::ProtectedFixtureFunctor::run() const at sal/cppunittester/cppunittester.cxx:316:20 (workdir/LinkTarget/Executable/cppunittester +0x440697)
> #60 in sal_main() at sal/cppunittester/cppunittester.cxx:466:20 (workdir/LinkTarget/Executable/cppunittester +0x43e2fc)
> #61 in main at sal/cppunittester/cppunittester.cxx:373:1 (workdir/LinkTarget/Executable/cppunittester +0x43d90e)
> #62 in __libc_start_main at /usr/src/debug/glibc-2.27-74-g68c1bf8097/csu/../csu/libc-start.c:308:16 (/lib64/libc.so.6 +0x2324a)
> #63 in _start at <null> (workdir/LinkTarget/Executable/cppunittester +0x4172a9)
Change-Id: I1e7458f831619ddf78d654656cdd9edcaf341aaa
Reviewed-on: https://gerrit.libreoffice.org/58928
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'lotuswordpro')
-rw-r--r-- | lotuswordpro/source/filter/lwppagelayout.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx index c083b37d0b59..2ce6bc94afe7 100644 --- a/lotuswordpro/source/filter/lwppagelayout.cxx +++ b/lotuswordpro/source/filter/lwppagelayout.cxx @@ -441,7 +441,7 @@ bool LwpPageLayout::HasFillerPageText(LwpFoundry const * pFoundry) if(eWhenType==LwpLayout::StartOnOddPage||eWhenType==LwpLayout::StartOnEvenPage) { //get pagenumber - sal_uInt16 nPageNumber = 0; + sal_Int32 nPageNumber = 0; //get the page number that current page layout inserted nPageNumber = GetPageNumber(FIRST_LAYOUTPAGENO)-1; |