external/freetype/ubsan.patch |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

New commits:
commit 328782955bc809bb2710e52a40ac98f4fa164022
Author:     Stephan Bergmann <stephan.bergm...@collabora.com>
AuthorDate: Tue Sep 16 20:35:56 2025 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Sep 17 18:29:55 2025 +0200

    external/freetype: Avoid signed-integer-overflow
    
    ...presumably after 981d8be918a7002ef4239244c8524dc73f0b5fd8 "freetype: 
upgrade
    to 2.14.1", causing e.g. CppunitTest_chart2_pivot_chart_test to fail with
    
    > workdir/UnpackedTarball/freetype/src/autofit/aflatin.c:3708:31: runtime 
error: signed integer overflow: 2161 - -9223372036854775808 cannot be 
represented in type 'FT_Pos' (aka 'long')
    >  #0 in af_glyph_hints_apply_vertical_separation_adjustments at 
workdir/UnpackedTarball/freetype/src/autofit/aflatin.c:3708:31
    >  #1 in af_latin_hints_apply at 
workdir/UnpackedTarball/freetype/src/autofit/aflatin.c:5054:9
    >  #2 in af_loader_load_glyph at 
workdir/UnpackedTarball/freetype/src/autofit/afloader.c:411:17
    >  #3 in af_autofitter_load_glyph at 
workdir/UnpackedTarball/freetype/src/autofit/afmodule.c:498:13
    >  #4 in FT_Load_Glyph at 
workdir/UnpackedTarball/freetype/src/base/ftobjs.c:1055:19
    >  #5  at <null> (/lib64/libcairo.so.2 +0x9be4b)
    >  #6  at <null> (/lib64/libcairo.so.2 +0xa0df1)
    >  #7  at <null> (/lib64/libcairo.so.2 +0x528b6)
    >  #8  at <null> (/lib64/libcairo.so.2 +0x57184)
    >  #9  at <null> (/lib64/libcairo.so.2 +0x179f6)
    >  #10  at <null> (/lib64/libcairo.so.2 +0x1a5f7)
    >  #11  at <null> (/lib64/libcairo.so.2 +0x27459)
    >  #12  at <null> (/lib64/libcairo.so.2 +0x701c8)
    >  #13  at <null> (/lib64/libcairo.so.2 +0x22a8b)
    >  #14 in cairo_show_glyphs at <null> (/lib64/libcairo.so.2 +0x78a7d)
    >  #15 in CairoTextRender::ImplDrawTextLayout(_cairo*, Color const&, 
GenericSalLayout const&, CairoCommon*, bool) at 
vcl/unx/generic/gdi/cairotextrender.cxx:517:9
    >  #16 in CairoTextRender::DrawTextLayout(GenericSalLayout const&, 
SalGraphics const&) at vcl/unx/generic/gdi/cairotextrender.cxx:292:5
    >  #17 in SvpSalGraphics::DrawTextLayout(GenericSalLayout const&) at 
vcl/headless/svptext.cxx:74:23
    >  #18 in GenericSalLayout::DrawText(SalGraphics&) const at 
vcl/source/gdi/CommonSalLayout.cxx:314:18
    >  #19 in OutputDevice::ImplDrawTextDirect(SalLayout&, bool) at 
vcl/source/outdev/text.cxx:311:16
    >  #20 in OutputDevice::ImplDrawText(SalLayout&) at 
vcl/source/outdev/text.cxx:464:9
    >  #21 in OutputDevice::DrawTextArray(Point const&, rtl::OUString const&, 
std::span<double const, 18446744073709551615ul>, std::span<unsigned char const, 
18446744073709551615ul>, int, int, SalLayoutFlags, SalLayoutGlyphs const*) at 
vcl/source/outdev/text.cxx:750:9
    >  #22 in ScOutputData::LayoutStringsImpl(bool, RowInfo*, short, int, 
unsigned long, std::optional<short>&, std::optional<short>&, short, 
std::__debug::vector<std::unique_ptr<ScPatternAttr, 
std::default_delete<ScPatternAttr>>, 
std::allocator<std::unique_ptr<ScPatternAttr, 
std::default_delete<ScPatternAttr>>>>&, ScPatternAttr const*&, SfxItemSet 
const*&, SvtScriptType&, ScDrawStringsVars&, bool&, long, long, bool, bool&, 
vcl::PDFExtOutDevData*, long, std::__debug::vector<double, 
std::allocator<double>>&) at sc/source/ui/view/output2.cxx:2248:28
    >  #23 in ScOutputData::LayoutStrings(bool) at 
sc/source/ui/view/output2.cxx:1565:17
    >  #24 in ScOutputData::DrawStrings(bool) at 
sc/source/ui/view/output2.cxx:1487:5
    >  #25 in ScPrintFunc::DrawToDev(ScDocument&, OutputDevice*, double, 
tools::Rectangle const&, ScViewData&, bool) at 
sc/source/ui/view/printfun.cxx:604:17
    >  #26 in ScDocShell::Draw(OutputDevice*, JobSetup const&, unsigned short, 
bool) at sc/source/ui/docshell/docsh4.cxx:2656:9
    >  #27 in SfxObjectShell::DoDraw_Impl(OutputDevice*, Point const&, Fraction 
const&, Fraction const&, JobSetup const&, unsigned short, bool) at 
sfx2/source/doc/objembed.cxx:204:5
    >  #28 in SfxObjectShell::DoDraw(OutputDevice*, Point const&, Size const&, 
JobSetup const&, unsigned short, bool) at sfx2/source/doc/objembed.cxx:151:9
    >  #29 in SfxObjectShell::CreatePreview_Impl(bool, bool, VirtualDevice*, 
GDIMetaFile*) const at sfx2/source/doc/objcont.cxx:201:40
    >  #30 in SfxObjectShell::GetPreviewBitmap() const at 
sfx2/source/doc/objcont.cxx:113:9
    >  #31 in SfxObjectShell::WriteThumbnail(bool, 
com::sun::star::uno::Reference<com::sun::star::io::XStream> const&) at 
sfx2/source/doc/objstor.cxx:4157:29
    >  #32 in SfxObjectShell::GenerateAndStoreThumbnail(bool, 
com::sun::star::uno::Reference<com::sun::star::embed::XStorage> const&) at 
sfx2/source/doc/objstor.cxx:4112:33
    >  #33 in SfxObjectShell::SaveTo_Impl(SfxMedium&, SfxItemSet const*) at 
sfx2/source/doc/objstor.cxx:1839:19
    >  #34 in SfxObjectShell::PreDoSaveAs_Impl(rtl::OUString const&, 
rtl::OUString const&, SfxItemSet const&, 
com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at 
sfx2/source/doc/objstor.cxx:3421:39
    >  #35 in SfxObjectShell::CommonSaveAs_Impl(INetURLObject const&, 
rtl::OUString const&, SfxItemSet&, 
com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at 
sfx2/source/doc/objstor.cxx:3212:9
    >  #36 in SfxObjectShell::APISaveAs_Impl(std::basic_string_view<char16_t, 
std::char_traits<char16_t>>, SfxItemSet&, 
com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at 
sfx2/source/doc/objserv.cxx:323:19
    >  #37 in SfxBaseModel::impl_store(rtl::OUString const&, 
com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, 
bool) at sfx2/source/doc/sfxbasemodel.cxx:3253:42
    >  #38 in SfxBaseModel::storeToURL(rtl::OUString const&, 
com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at 
sfx2/source/doc/sfxbasemodel.cxx:1834:13
    >  #39 in 
UnoApiTest::saveWithParams(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>
 const&) at test/source/unoapi_test.cxx:194:16
    >  #40 in UnoApiTest::save(rtl::OUString const&, char const*) at 
test/source/unoapi_test.cxx:178:5
    >  #41 in UnoApiTest::saveAndReload(rtl::OUString const&, char const*) at 
test/source/unoapi_test.cxx:199:5
    >  #42 in PivotChartTest::testRoundtrip() at 
chart2/qa/extras/PivotChartTest.cxx:354:5
    
    Change-Id: I6bb42532fce1291b4208108ab1898b94dda02e68
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191043
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <stephan.bergm...@collabora.com>
    (cherry picked from commit a8133d29ce58ab775319e837477c649489182d6d)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191064
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    (cherry picked from commit fb9337d51a3988f9b09aaca567b205a6917b9b4e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191096

diff --git a/external/freetype/ubsan.patch b/external/freetype/ubsan.patch
index e915bedf7a46..f7099f110eec 100644
--- a/external/freetype/ubsan.patch
+++ b/external/freetype/ubsan.patch
@@ -1,3 +1,19 @@
+--- src/autofit/aflatin.c
++++ src/autofit/aflatin.c
+@@ -3705,11 +3705,13 @@
+         /* We also check that the y minimum of the 'other' contour */
+         /* is below the high contour to avoid potential false hits */
+         /* with contours enclosed in the high one.                 */
++        if (max_y != FT_LONG_MIN) {
+         distance = high_min_y - max_y;
+         if ( distance < 64           &&
+              distance < min_distance &&
+              min_y < high_min_y      )
+           min_distance = distance;
++        }
+       }
+ 
+       adjustment_amount = 64 - min_distance;
 --- src/truetype/ttgxvar.c
 +++ src/truetype/ttgxvar.c
 @@ -1217,7 +1217,7 @@

Reply via email to