vcl/source/gdi/graph.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
New commits: commit e1fe04f117030400f07d207e0a3e35161ac464fa Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Thu Jul 29 09:48:45 2021 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Thu Jul 29 10:58:06 2021 +0200 Avoid some division by zero The first of which was seen when running under UBSan `instdir/program/soffice --headless --convert-to pdf` of caolan/id:002485,src:002216,op:havoc,rep:8.jpg from the crash-testing corpus. The second one (when computing nGrfDPIy) was not observed, but lets assume that it could happen just as well, and keep the code symmetric. Change-Id: Idf9f9a84f3b05c7cfe3c66db753c73d2cbf812be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119650 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx index 5e71e5d1a0d4..352073455e01 100644 --- a/vcl/source/gdi/graph.cxx +++ b/vcl/source/gdi/graph.cxx @@ -400,8 +400,10 @@ basegfx::B2DSize Graphic::GetPPI() const { const Size aGrf1000thInchSize = OutputDevice::LogicToLogic( aGrfPrefMapModeSize, aGrfMap, MapMode(MapUnit::Map1000thInch)); - nGrfDPIx = 1000.0 * aGrfPixelSize.Width() / aGrf1000thInchSize.Width(); - nGrfDPIy = 1000.0 * aGrfPixelSize.Height() / aGrf1000thInchSize.Height(); + nGrfDPIx = aGrf1000thInchSize.Width() == 0 + ? 0.0 : 1000.0 * aGrfPixelSize.Width() / aGrf1000thInchSize.Width(); + nGrfDPIy = aGrf1000thInchSize.Height() == 0 + ? 0.0 : 1000.0 * aGrfPixelSize.Height() / aGrf1000thInchSize.Height(); } return basegfx::B2DSize(nGrfDPIx, nGrfDPIy); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits