vcl/source/gdi/metaact.cxx |   19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 7f43f00d55bc32fd62c2f72cb0343f9419eb8491
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sat Mar 16 20:56:01 2024 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Sat Mar 16 22:30:25 2024 +0100

    ofz#67445 Timeout
    
    Change-Id: I968f57c9c71e764ade189deca1534983e33cc401
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164932
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index bea295fb416e..81d72cdf8dbd 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -735,9 +735,26 @@ MetaStretchTextAction::MetaStretchTextAction( const Point& 
rPt, sal_uInt32 nWidt
 
 void MetaStretchTextAction::Execute( OutputDevice* pOut )
 {
-    if (!AllowDim(pOut->LogicToPixel(maPt).Y()))
+    if (!AllowRect(pOut->LogicToPixel(tools::Rectangle(maPt, Size(mnWidth, 
pOut->GetTextHeight())))))
         return;
 
+    static bool bFuzzing = comphelper::IsFuzzing();
+    if (bFuzzing && mnWidth > 10000)
+    {
+        FontLineStyle eUnderline = pOut->GetFont().GetUnderline();
+        FontLineStyle eOverline = pOut->GetFont().GetOverline();
+
+        if (eUnderline == LINESTYLE_SMALLWAVE || eUnderline == LINESTYLE_WAVE 
||
+            eUnderline == LINESTYLE_DOUBLEWAVE || eUnderline == 
LINESTYLE_BOLDWAVE ||
+            eOverline == LINESTYLE_SMALLWAVE || eOverline == LINESTYLE_WAVE ||
+            eOverline == LINESTYLE_DOUBLEWAVE || eOverline == 
LINESTYLE_BOLDWAVE)
+        {
+            SAL_WARN("vcl.gdi", "MetaStretchTextAction::Execute, skipping 
suspicious WaveTextLine of length: "
+                                    << mnWidth << " for fuzzing performance");
+            return;
+        }
+    }
+
     pOut->DrawStretchText( maPt, mnWidth, maStr, mnIndex, mnLen );
 }
 

Reply via email to