office-gobmx/tools
Stephan Bergmann b0195d40f3 Avoid signed integer overflow
...as seen at

> /tools/source/misc/fix16.cxx:79:53: runtime error: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'
>     #0 0x7fc2f9f50a60 in mask(int) /tools/source/misc/fix16.cxx:79:53
>     #1 0x7fc2f9f505fd in fix16_div(int, int) /tools/source/misc/fix16.cxx:122:34
>     #2 0x7fc2f00d12e0 in vcl::fixedDiv(int, int) /vcl/source/fontsubset/sft.cxx:127:12
>     #3 0x7fc2f00d11c1 in vcl::fixedMulDiv(int, int, int) /vcl/source/fontsubset/sft.cxx:135:12
>     #4 0x7fc2f00d0851 in vcl::GetCompoundTTOutline(vcl::AbstractTrueTypeFont*, unsigned int, std::__debug::vector<vcl::ControlPoint, std::allocator<vcl::ControlPoint> >&, vcl::(anonymous namespace)::TTGlyphMetrics*, std::__debug::vector<unsigned int, std::allocator<unsigned int> >&) /vcl/source/fontsubset/sft.cxx:544:91
>     #5 0x7fc2f00af5f1 in vcl::GetTTGlyphOutline(vcl::AbstractTrueTypeFont*, unsigned int, std::__debug::vector<vcl::ControlPoint, std::allocator<vcl::ControlPoint> >&, vcl::(anonymous namespace)::TTGlyphMetrics*, std::__debug::vector<unsigned int, std::allocator<unsigned int> >*) /vcl/source/fontsubset/sft.cxx:621:15
>     #6 0x7fc2f00aea34 in vcl::GetTTGlyphPoints(vcl::AbstractTrueTypeFont*, unsigned int, std::__debug::vector<vcl::ControlPoint, std::allocator<vcl::ControlPoint> >&) /vcl/source/fontsubset/sft.cxx:1239:12
>     #7 0x7fc2f00b92de in vcl::GetTTRawGlyphData(vcl::AbstractTrueTypeFont*, unsigned int) /vcl/source/fontsubset/sft.cxx:1667:9
>     #8 0x7fc2f00b23ed in vcl::CreateTTFromTTGlyphs(vcl::AbstractTrueTypeFont*, std::__debug::vector<unsigned char, std::allocator<unsigned char> >&, unsigned short const*, unsigned char const*, int) /vcl/source/fontsubset/sft.cxx:1374:32
>     #9 0x7fc2f00bc71a in vcl::CreateTTFfontSubset(vcl::AbstractTrueTypeFont&, std::__debug::vector<unsigned char, std::allocator<unsigned char> >&, unsigned int const*, unsigned char const*, int, FontSubsetInfo&) /vcl/source/fontsubset/sft.cxx:1549:13
>     #10 0x7fc2eff57836 in vcl::font::PhysicalFontFace::CreateFontSubset(std::__debug::vector<unsigned char, std::allocator<unsigned char> >&, unsigned int const*, unsigned char const*, int, FontSubsetInfo&) const /vcl/source/font/PhysicalFontFace.cxx:367:12
>     #11 0x7fc2ee4e0472 in vcl::PDFWriterImpl::emitFonts() /vcl/source/gdi/pdfwriter_impl.cxx:3152:24
>     #12 0x7fc2ee4e9cb9 in vcl::PDFWriterImpl::emitResources() /vcl/source/gdi/pdfwriter_impl.cxx:3363:10
>     #13 0x7fc2ee53f91d in vcl::PDFWriterImpl::emitCatalog() /vcl/source/gdi/pdfwriter_impl.cxx:5288:10
>     #14 0x7fc2ee567ae3 in vcl::PDFWriterImpl::emit() /vcl/source/gdi/pdfwriter_impl.cxx:6341:10
>     #15 0x7fc2ee3d3f2a in vcl::PDFWriter::Emit() /vcl/source/gdi/pdfwriter.cxx:53:29
>     #16 0x7fc249b4b82a in PDFExport::Export(rtl::OUString const&, com::sun::uno::Sequence<com::sun:🫘:PropertyValue> const&) /filter/source/pdf/pdfexport.cxx:1127:39
>     #17 0x7fc249bb2782 in PDFFilter::implExport(com::sun::uno::Sequence<com::sun:🫘:PropertyValue> const&) /filter/source/pdf/pdffilter.cxx:182:24
>     #18 0x7fc249bb342b in PDFFilter::filter(com::sun::uno::Sequence<com::sun:🫘:PropertyValue> const&) /filter/source/pdf/pdffilter.cxx:247:23
>     #19 0x7fc2a51ebec6 in SfxObjectShell::ExportTo(SfxMedium&) /sfx2/source/doc/objstor.cxx:2945:25
>     #20 0x7fc2a51d7bec in SfxObjectShell::SaveTo_Impl(SfxMedium&, SfxItemSet const*) /sfx2/source/doc/objstor.cxx:1943:19
>     #21 0x7fc2a5213f83 in SfxObjectShell::PreDoSaveAs_Impl(rtl::OUString const&, rtl::OUString const&, SfxItemSet const&, com::sun::uno::Sequence<com::sun:🫘:PropertyValue> const&) /sfx2/source/doc/objstor.cxx:3459:39
>     #22 0x7fc2a520b709 in SfxObjectShell::CommonSaveAs_Impl(INetURLObject const&, rtl::OUString const&, SfxItemSet&, com::sun::uno::Sequence<com::sun:🫘:PropertyValue> const&) /sfx2/source/doc/objstor.cxx:3249:9
>     #23 0x7fc2a5147a8b in SfxObjectShell::APISaveAs_Impl(std::basic_string_view<char16_t, std::char_traits<char16_t> >, SfxItemSet&, com::sun::uno::Sequence<com::sun:🫘:PropertyValue> const&) /sfx2/source/doc/objserv.cxx:320:19
>     #24 0x7fc2a543024c in SfxBaseModel::impl_store(rtl::OUString const&, com::sun::uno::Sequence<com::sun:🫘:PropertyValue> const&, bool) /sfx2/source/doc/sfxbasemodel.cxx:3231:42
>     #25 0x7fc2a54374f4 in SfxBaseModel::storeToURL(rtl::OUString const&, com::sun::uno::Sequence<com::sun:🫘:PropertyValue> const&) /sfx2/source/doc/sfxbasemodel.cxx:1813:13
>     #26 0x7fc2c74053ae in ScPDFExportTest::exportToPDF(com::sun::uno::Reference<com::sun::frame::XModel> const&, ScRange const&) /sc/qa/extras/scpdfexport.cxx:179:16
>     #27 0x7fc2c7437e0f in ScPDFExportTest::testForcepoint97() /sc/qa/extras/scpdfexport.cxx:915:5

during CppunitTest_sc_pdf_export
(<https://ci.libreoffice.org/job/lo_ubsan/3346/>)

Change-Id: I3074479ea3267417a73ecafa81b4a9898f19d1a9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175469
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Tested-by: Jenkins
2024-10-23 12:10:21 +02:00
..
inc loplugin:noexceptmove (macOS, LLVM 20 trunk libc++) 2024-09-30 11:21:34 +02:00
qa Make tools::Time ctor taking sal_Int64 private 2024-10-21 10:30:58 +02:00
source Avoid signed integer overflow 2024-10-23 12:10:21 +02:00
CppunitTest_tools_config.mk
CppunitTest_tools_test.mk Drop FRound, and use generalized basegfx::fround 2024-04-17 03:56:59 +02:00
CppunitTest_tools_unique_id.mk move UniqueID to tools and rework to increase counter in constructor 2024-07-07 09:41:02 +02:00
CustomTarget_reversemap.mk makefile simplification: replace $(call gb_CustomTarget_get_workdir,foo) 2024-05-03 16:06:14 +02:00
Executable_bestreversemap.mk
IwyuFilter_tools.yaml
Library_tl.mk move vcl::DeleteOnDeinit to tools 2024-10-22 08:01:19 +02:00
Makefile
Module_tools.mk move UniqueID to tools and rework to increase counter in constructor 2024-07-07 09:41:02 +02:00
README.md
StaticLibrary_ooopathutils.mk

Old Tools (Deprecated)

Predates sal - string functions, url manipulation, stream stuff, polygons, etc.

Exact history is lost before Sept. 18th, 2000, but old source code comments show that part of the tools library dates back until at least April 1991.

This directory will be removed in the near future (see tdf#39445 or tdf#63154).