diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-08-13 16:57:45 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-08-14 08:26:26 +0200 |
commit | 095e1ca4372d90da7fc56051f1271ddd975a9e3a (patch) | |
tree | 02a41f110fdbf1f7d54c106bef9383f53ddcd41e | |
parent | 0e50b4bea313509b57fc15c4e4ced8be6f22bd49 (diff) |
Assume that EMR_SETWINDOWEXTEX wants to read signed values
...rather than unsigned ones. With Clang's new -fsanitize=implicit-conversion,
CppunitTest_vcl_filters_test fails in a way (see below) suggesting that it wants
to read a negative sal_Int32 value here (that naturally extends to the same
negative value of type long when constructing the Size instance) instead of a
large unsigned sal_uInt32 value (that extends to a large positive (64-bit) long
value).
The code is like that effectively ever since its introduction with
c7470f5be441d8fe80155ff29605d74d5838be26 "emfplus: add rough version of local
reader". (In case that's relevant, <https://docs.microsoft.com/en-us/windows/
desktop/api/wingdi/nf-wingdi-setwindowextex> documents the SetWindowExtEx
function as taking x and y parameters of (signed) int type.)
> Testing file:///home/sbergman/lo/core/vcl/qa/cppunit/graphicfilter/data/wmf/fail/facename-1.wmf:
> emfio/source/reader/mtftools.cxx:1961:33: runtime error: implicit conversion from type 'long' of value 2273774060 (64-bit, signed) to type 'sal_Int32' (aka 'int') changed the value to -2021193236 (32-bit, signed)
> #0 in emfio::MtfTools::SetWinExt(Size const&, bool) at emfio/source/reader/mtftools.cxx:1961:33 (instdir/program/libemfiolo.so +0xedacd)
> #1 in emfio::EmfReader::ReadEnhWMF() at emfio/source/reader/emfreader.cxx:754:25 (instdir/program/libemfiolo.so +0x152e99)
> #2 in emfio::WmfReader::ReadWMF() at emfio/source/reader/wmfreader.cxx:1434:57 (instdir/program/libemfiolo.so +0x12f7ac)
> #3 in emfio::emfreader::XEmfParser::getDecomposition(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at emfio/source/emfuno/xemfparser.cxx:149:104 (instdir/program/libemfiolo.so +0xb14bc)
> #4 in non-virtual thunk to emfio::emfreader::XEmfParser::getDecomposition(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at emfio/source/emfuno/xemfparser.cxx (instdir/program/libemfiolo.so +0xb1e22)
> #5 in VectorGraphicData::ensureSequenceAndRange() at vcl/source/gdi/vectorgraphicdata.cxx:171:137 (instdir/program/libvcllo.so +0x49121b2)
> #6 in VectorGraphicData::getRange() const at vcl/source/gdi/vectorgraphicdata.cxx:273:45 (instdir/program/libvcllo.so +0x4912c4e)
> #7 in VclFiltersTest::load(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int) at vcl/qa/cppunit/graphicfilter/filters-test.cxx:78:46 (workdir/LinkTarget/CppunitTest/libtest_vcl_filters_test.so +0x18010)
> #8 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)
> #9 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)
> #10 in VclFiltersTest::testCVEs() at vcl/qa/cppunit/graphicfilter/filters-test.cxx:149:5 (workdir/LinkTarget/CppunitTest/libtest_vcl_filters_test.so +0x1a30f)
> #11 in void std::__invoke_impl<void, void (VclFiltersTest::*&)(), VclFiltersTest*&>(std::__invoke_memfun_deref, void (VclFiltersTest::*&)(), VclFiltersTest*&) at /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/bits/invoke.h:73:14 (workdir/LinkTarget/CppunitTest/libtest_vcl_filters_test.so +0x2c0bd)
> #12 in std::__invoke_result<void (VclFiltersTest::*&)(), VclFiltersTest*&>::type std::__invoke<void (VclFiltersTest::*&)(), VclFiltersTest*&>(void (VclFiltersTest::*&)(), VclFiltersTest*&) at /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/bits/invoke.h:95:14 (workdir/LinkTarget/CppunitTest/libtest_vcl_filters_test.so +0x2bd5b)
> #13 in void std::_Bind<void (VclFiltersTest::* (VclFiltersTest*))()>::__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_vcl_filters_test.so +0x2bc08)
> #14 in void std::_Bind<void (VclFiltersTest::* (VclFiltersTest*))()>::operator()<void>() at /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/functional:482:17 (workdir/LinkTarget/CppunitTest/libtest_vcl_filters_test.so +0x2b945)
> #15 in std::_Function_handler<void (), std::_Bind<void (VclFiltersTest::* (VclFiltersTest*))()> >::_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_vcl_filters_test.so +0x2aa56)
> #16 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_vcl_filters_test.so +0x2c656)
> #17 in CppUnit::TestCaller<VclFiltersTest>::runTest() at workdir/UnpackedTarball/cppunit/include/cppunit/TestCaller.h:175:7 (workdir/LinkTarget/CppunitTest/libtest_vcl_filters_test.so +0x29ec6)
> #18 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)
> #19 in (anonymous namespace)::Protector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) at test/source/vclbootstrapprotector.cxx:49:14 (workdir/LinkTarget/Library/libvclbootstrapprotector.so +0x159a)
> #20 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)
> #21 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)
> #22 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)
> #23 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)
> #24 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)
> #25 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)
> #26 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)
> #27 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)
> #28 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)
> #29 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)
> #30 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)
> #31 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)
> #32 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)
> #33 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)
> #34 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)
> #35 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)
> #36 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)
> #37 in (anonymous namespace)::ProtectedFixtureFunctor::run() const at sal/cppunittester/cppunittester.cxx:316:20 (workdir/LinkTarget/Executable/cppunittester +0x440697)
> #38 in sal_main() at sal/cppunittester/cppunittester.cxx:466:20 (workdir/LinkTarget/Executable/cppunittester +0x43e2fc)
> #39 in main at sal/cppunittester/cppunittester.cxx:373:1 (workdir/LinkTarget/Executable/cppunittester +0x43d90e)
> #40 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)
> #41 in _start at <null> (workdir/LinkTarget/Executable/cppunittester +0x4172a9)
Change-Id: Ia3899d2e80f9dc22329f7739a0c2be3cb465e967
Reviewed-on: https://gerrit.libreoffice.org/58940
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r-- | emfio/source/reader/emfreader.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx index f4a0bd300947..f1138d39e23a 100644 --- a/emfio/source/reader/emfreader.cxx +++ b/emfio/source/reader/emfreader.cxx @@ -750,8 +750,9 @@ namespace emfio case EMR_SETWINDOWEXTEX : { - mpInputStream->ReadUInt32( nW ).ReadUInt32( nH ); - SetWinExt( Size( nW, nH ), true); + sal_Int32 w = 0, h = 0; + mpInputStream->ReadInt32( w ).ReadInt32( h ); + SetWinExt( Size( w, h ), true); } break; |