tdf#168843: Sanitize font size read from PPT

Add validation checks for font size when importing a PPT. Minimum
accepted value for font size is 100.

Change-Id: I0c00705eafde1befe459cf8ba52ce32b1dbfbd5d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193539
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
(cherry picked from commit 28273e586b398e2ce181c4ce9e740949fad11876)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194633
Code-Style: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
This commit is contained in:
Karthik Godha
2025-11-26 16:51:58 +01:00
committed by Xisco Fauli
parent 7d3bd39c51
commit 5f1043dab5
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -5591,7 +5591,7 @@ void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, T
}
if ( GetAttrib( PPT_CharAttr_FontHeight, nVal, nDestinationInstance ) ) // Font size in Point
{
constexpr sal_uInt32 MIN_FONT_HEIGHT_PT = 2;
constexpr sal_uInt32 MIN_FONT_HEIGHT_PT = 1;
sal_uInt32 nHeight = rManager.ScalePoint(std::max(nVal, MIN_FONT_HEIGHT_PT));
rSet.Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) );
+1 -1
View File
@@ -2685,7 +2685,7 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool
}
}
assert(nSize >= 200 && "Minimum accepted value for fontsize(ST_TextFontSize) is 200");
assert(nSize >= 100 && "Minimum accepted value for fontsize(ST_TextFontSize) is 100");
mpFS->startElementNS( XML_a, nElement,
XML_lang, sax_fastparser::UseIf(usLanguage, !usLanguage.isEmpty()),