summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2023-09-25 10:40:50 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2023-09-25 14:17:17 +0200
commit788ef4f347d8a3c87d45d38ce6bf13cdd3dd76a2 (patch)
tree2834025c32bac3f714a95cb541c3ef3311ae2fde
parent71cae3a219ff1629368b8f324d0de89afc9445e9 (diff)
ofz#62439 Integer-overflow on scale using SAL_MIN_INT32
Change-Id: Ib26feee174caab9f515cd88cc3cb4a83debb0d99 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157242 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r--vcl/source/gdi/TypeSerializer.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/vcl/source/gdi/TypeSerializer.cxx b/vcl/source/gdi/TypeSerializer.cxx
index 9144650154af..49890fc38ea0 100644
--- a/vcl/source/gdi/TypeSerializer.cxx
+++ b/vcl/source/gdi/TypeSerializer.cxx
@@ -435,6 +435,10 @@ static bool UselessScaleForMapMode(const Fraction& rScale)
{
if (!rScale.IsValid())
return true;
+ // ofz#62439 negative numbers are multiplied by -1, MIN_INT32 * -1
+ // cannot be expressed as an int
+ if (rScale.GetNumerator() == std::numeric_limits<sal_Int32>::min())
+ return true;
if (static_cast<double>(rScale) < 0.0)
return true;
return false;