From: Antti Villberg Date: Wed, 16 Aug 2017 09:49:09 +0000 (+0300) Subject: renderSVG hardening X-Git-Tag: v1.31.0~237^2~1 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=71ec74823894138693ed9cde9e22270453fb4127;p=simantics%2Fplatform.git renderSVG hardening refs #7421 Change-Id: I307f298d8c7c6adfa2627634c3f4d0a6db3e2afb --- diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java index 5f375095f..3e81b1c5c 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java @@ -632,11 +632,15 @@ public class SCLScenegraph { double trX = -1 * content.getX(); double trY = -1 * content.getY(); + // NaNs + if(!Double.isFinite(trX)) trX = 0; + if(!Double.isFinite(trY)) trY = 0; + result.append(MAIN_SECTION, ""); + result.append(MAIN_SECTION, ")\">"); result.append(SELECTION_SECTION, ""); @@ -785,10 +789,13 @@ public class SCLScenegraph { parentBuilder2.append(SELECTION_SECTION, "\n"); parentBuilder2.append(SELECTION_MASK_SECTION, "\n"); Rectangle2D rect = n.getRect(); - parentBuilder2.append(SELECTION_MASK_SECTION,""); + // NaN + if(rect.getHeight() == rect.getHeight() && rect.getWidth() == rect.getWidth()) { + parentBuilder2.append(SELECTION_MASK_SECTION,""); + } parentBuilder2.append(SELECTION_MASK_SECTION,"\n"); } } else if (node instanceof SVGNode) {