vcl/source/gdi/metaact.cxx | 54 +++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 24 deletions(-)
New commits: commit c77ecfbdbee4b03225e9dad7cbedd5c9c7be0995 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Sun Dec 31 14:22:00 2023 +0000 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Sun Dec 31 23:01:51 2023 +0100 ofz#65266 Timeout Change-Id: I15f4acfd60fa7a7d02dd06be02b33383b21a33b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161499 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index c1d7e5327dd7..bea295fb416e 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -237,8 +237,35 @@ MetaRectAction::MetaRectAction( const tools::Rectangle& rRect ) : maRect ( rRect ) {} +static bool AllowDim(tools::Long nDim) +{ + static bool bFuzzing = comphelper::IsFuzzing(); + if (bFuzzing) + { + if (nDim > 0x20000000 || nDim < -0x20000000) + { + SAL_WARN("vcl", "skipping huge dimension: " << nDim); + return false; + } + } + return true; +} + +static bool AllowPoint(const Point& rPoint) +{ + return AllowDim(rPoint.X()) && AllowDim(rPoint.Y()); +} + +static bool AllowRect(const tools::Rectangle& rRect) +{ + return AllowPoint(rRect.TopLeft()) && AllowPoint(rRect.BottomRight()); +} + void MetaRectAction::Execute( OutputDevice* pOut ) { + if (!AllowRect(pOut->LogicToPixel(maRect))) + return; + pOut->DrawRect( maRect ); } @@ -463,30 +490,6 @@ MetaPolyLineAction::MetaPolyLineAction( tools::Polygon aPoly, LineInfo aLineInfo maPoly (std::move( aPoly )) {} -static bool AllowDim(tools::Long nDim) -{ - static bool bFuzzing = comphelper::IsFuzzing(); - if (bFuzzing) - { - if (nDim > 0x20000000 || nDim < -0x20000000) - { - SAL_WARN("vcl", "skipping huge dimension: " << nDim); - return false; - } - } - return true; -} - -static bool AllowPoint(const Point& rPoint) -{ - return AllowDim(rPoint.X()) && AllowDim(rPoint.Y()); -} - -static bool AllowRect(const tools::Rectangle& rRect) -{ - return AllowPoint(rRect.TopLeft()) && AllowPoint(rRect.BottomRight()); -} - void MetaPolyLineAction::Execute( OutputDevice* pOut ) { if (!AllowRect(pOut->LogicToPixel(maPoly.GetBoundRect()))) @@ -822,6 +825,9 @@ void MetaTextLineAction::Execute( OutputDevice* pOut ) SAL_WARN("vcl", "skipping line with negative width: " << mnWidth); return; } + if (!AllowRect(pOut->LogicToPixel(tools::Rectangle(maPos, Size(mnWidth, pOut->GetTextHeight()))))) + return; + pOut->DrawTextLine( maPos, mnWidth, meStrikeout, meUnderline, meOverline ); }