Changeset 14328 in josm for trunk/src/com/kitfox/svg/ImageSVG.java
- Timestamp:
- 2018-10-14T15:15:50+02:00 (7 years ago)
- File:
-
- 1 edited
-
trunk/src/com/kitfox/svg/ImageSVG.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/com/kitfox/svg/ImageSVG.java
r11526 r14328 115 115 { 116 116 URI src = sty.getURIValue(getXMLBase()); 117 // CVE-2017-5617: Allow only data scheme118 117 if ("data".equals(src.getScheme())) 119 118 { 120 119 imageSrc = new URL(null, src.toASCIIString(), new Handler()); 121 120 } 121 else 122 { 123 if (!diagram.getUniverse().isImageDataInlineOnly()) 124 { 125 try 126 { 127 imageSrc = src.toURL(); 128 } catch (Exception e) 129 { 130 Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, 131 "Could not parse xlink:href " + src, e); 132 imageSrc = null; 133 } 134 } 135 } 122 136 } 123 137 } catch (Exception e) … … 126 140 } 127 141 128 if (imageSrc != null) 129 { 130 diagram.getUniverse().registerImage(imageSrc); 131 132 //Set widths if not set 133 BufferedImage img = diagram.getUniverse().getImage(imageSrc); 134 if (img == null) 135 { 136 xform = new AffineTransform(); 137 bounds = new Rectangle2D.Float(); 138 return; 139 } 140 141 if (width == 0) 142 { 143 width = img.getWidth(); 144 } 145 if (height == 0) 146 { 147 height = img.getHeight(); 148 } 149 150 //Determine image xform 142 diagram.getUniverse().registerImage(imageSrc); 143 144 //Set widths if not set 145 BufferedImage img = diagram.getUniverse().getImage(imageSrc); 146 if (img == null) 147 { 151 148 xform = new AffineTransform(); 152 xform.translate(this.x, this.y); 153 xform.scale(this.width / img.getWidth(), this.height / img.getHeight()); 154 } 149 bounds = new Rectangle2D.Float(); 150 return; 151 } 152 153 if (width == 0) 154 { 155 width = img.getWidth(); 156 } 157 if (height == 0) 158 { 159 height = img.getHeight(); 160 } 161 162 //Determine image xform 163 xform = new AffineTransform(); 164 xform.translate(this.x, this.y); 165 xform.scale(this.width / img.getWidth(), this.height / img.getHeight()); 155 166 156 167 bounds = new Rectangle2D.Float(this.x, this.y, this.width, this.height); … … 326 337 URI src = sty.getURIValue(getXMLBase()); 327 338 328 URL newVal = null; 329 // CVE-2017-5617: Allow only data scheme 339 URL newVal; 330 340 if ("data".equals(src.getScheme())) 331 341 { 332 342 newVal = new URL(null, src.toASCIIString(), new Handler()); 343 } else 344 { 345 newVal = src.toURL(); 333 346 } 334 347 335 if ( newVal != null &&!newVal.equals(imageSrc))348 if (!newVal.equals(imageSrc)) 336 349 { 337 350 imageSrc = newVal;
Note:
See TracChangeset
for help on using the changeset viewer.
