vcl/source/gdi/metaact.cxx |   19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

New commits:
commit f2033b6623e13ad70f6648545571594a8cd848c7
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Mar 23 16:31:04 2023 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Fri Mar 24 10:02:42 2023 +0000

    ofz#57146 Integer-overflow
    
    Change-Id: Ic5a86254b5d969c8242c124fa0515e4f1537114f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149460
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index 71dbe5daa4e4..89c60fbe7baa 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -570,28 +570,33 @@ MetaTextAction::MetaTextAction( const Point& rPt, 
OUString aStr,
     mnLen       ( nLen )
 {}
 
-static bool AllowY(tools::Long nY)
+static bool AllowDim(tools::Long nDim)
 {
     static bool bFuzzing = utl::ConfigManager::IsFuzzing();
     if (bFuzzing)
     {
-        if (nY > 0x20000000 || nY < -0x20000000)
+        if (nDim > 0x20000000 || nDim < -0x20000000)
         {
-            SAL_WARN("vcl", "skipping huge y: " << nY);
+            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 AllowY(rRect.Top()) && AllowY(rRect.Bottom());
+    return AllowDim(rRect.Top()) && AllowDim(rRect.Bottom());
 }
 
 void MetaTextAction::Execute( OutputDevice* pOut )
 {
-    if (!AllowY(pOut->LogicToPixel(maPt).Y()))
+    if (!AllowDim(pOut->LogicToPixel(maPt).Y()))
         return;
 
     pOut->DrawText( maPt, maStr, mnIndex, mnLen );
@@ -724,7 +729,7 @@ MetaStretchTextAction::MetaStretchTextAction( const Point& 
rPt, sal_uInt32 nWidt
 
 void MetaStretchTextAction::Execute( OutputDevice* pOut )
 {
-    if (!AllowY(pOut->LogicToPixel(maPt).Y()))
+    if (!AllowDim(pOut->LogicToPixel(maPt).Y()))
         return;
 
     pOut->DrawStretchText( maPt, mnWidth, maStr, mnIndex, mnLen );
@@ -1483,7 +1488,7 @@ MetaMoveClipRegionAction::MetaMoveClipRegionAction( 
tools::Long nHorzMove, tools
 
 void MetaMoveClipRegionAction::Execute( OutputDevice* pOut )
 {
-    if (!AllowY(pOut->LogicToPixel(Point(mnHorzMove, mnVertMove)).Y()))
+    if (!AllowPoint(pOut->LogicToPixel(Point(mnHorzMove, mnVertMove))))
         return;
     pOut->MoveClipRegion( mnHorzMove, mnVertMove );
 }

Reply via email to