summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-03-16 21:20:20 +0000
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-03-17 22:17:23 +0100
commit81fa9b03ca8175d2be8ff261916d22c54a4d73a3 (patch)
tree79f5b498810d5bf0645f21de0373d2018ce6326b /vcl
parent8cce20756857cc3c42a2f9393afe6886c4abc1ea (diff)
ofz#66825 Out-of-memory
Change-Id: Ic3ce086dc6ba3f85824ec1e68d7501f278f758ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164935 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/headless/CairoCommon.cxx13
1 files changed, 8 insertions, 5 deletions
diff --git a/vcl/headless/CairoCommon.cxx b/vcl/headless/CairoCommon.cxx
index 9a84903e5483..38b0bf9418df 100644
--- a/vcl/headless/CairoCommon.cxx
+++ b/vcl/headless/CairoCommon.cxx
@@ -1095,14 +1095,17 @@ bool CairoCommon::drawPolyLine(const basegfx::B2DHomMatrix& rObjectToDevice,
cairo_set_line_join(cr, eCairoLineJoin);
cairo_set_line_cap(cr, eCairoLineCap);
- constexpr int MaxNormalLineWidth = 64;
- if (fLineWidth > MaxNormalLineWidth)
+ constexpr int MaxNormalLineWidthPx = 64;
+ if (fLineWidth > MaxNormalLineWidthPx)
{
const double fLineWidthPixel
= bObjectToDeviceIsIdentity
? fLineWidth
: (rObjectToDevice * basegfx::B2DVector(fLineWidth, 0)).getLength();
- if (fLineWidthPixel > MaxNormalLineWidth)
+ constexpr double MaxLineWidth = 0x20000000;
+ // if the width is pixels is excessive, or if the actual number is huge, then
+ // when fuzzing drop it to something small
+ if (fLineWidthPixel > MaxNormalLineWidthPx || fLineWidth > MaxLineWidth)
{
SAL_WARN("vcl.gdi", "drawPolyLine, suspicious input line width of: "
<< fLineWidth << ", will be " << fLineWidthPixel
@@ -1111,8 +1114,8 @@ bool CairoCommon::drawPolyLine(const basegfx::B2DHomMatrix& rObjectToDevice,
{
basegfx::B2DHomMatrix aObjectToDeviceInv(rObjectToDevice);
aObjectToDeviceInv.invert();
- fLineWidth
- = (aObjectToDeviceInv * basegfx::B2DVector(MaxNormalLineWidth, 0)).getLength();
+ fLineWidth = (aObjectToDeviceInv * basegfx::B2DVector(MaxNormalLineWidthPx, 0))
+ .getLength();
fLineWidth = std::min(fLineWidth, 2048.0);
}
}