Hi,

I found an issue where the SDL renderer gets into an infinite loop when
using a GraphicStroke line simbolyzer with the uom extension. To
reproduce, consider the following SDL fragment:

<sld:LineSymbolizer uom="http://www.opengeospatial.org/se/units/metre";>
    <sld:Stroke>
        <sld:GraphicStroke>
            <sld:Graphic>
                <sld:Mark>
                  <sld:WellKnownName>shape://vertline</sld:WellKnownName>
                   <sld:Stroke>
                       <sld:CssParameter
name="stroke">#000000</sld:CssParameter>
                        <sld:CssParameter
name="stroke-width">1</sld:CssParameter>
                    </sld:Stroke>
                </sld:Mark>
                <sld:Size>12</sld:Size>
            </sld:Graphic>
        </sld:GraphicStroke>
        <sld:CssParameter name="stroke-dasharray">12 18</sld:CssParameter>
    </sld:Stroke>
</sld:LineSymbolizer>


when trying to render, say lines of an OSM database with the above,
geoserver gets into an infinite loop.

I looked at the code, and found the following, although I'm not sure how
to fix the issue. the infinite loop is this one, in StyledShapePainter,
starting at line 466:

for (dist = remainder; dist < len; dist += imageSize) {
    renderGraphicsStroke(graphics, x, y, graphicStroke, rotation, 1,
isLabelObstacle);

    x += dx;
    y += dy;
}


and the reason is that imageSize == 0, thus dist does not increase.

looking at the code, it turns out that imageSize comes from a
MarkStyle2D object's size attribute, which is 0. it is set to 0 in
SLDStyleFactory.createPointStyle(), line 647:

ms2d.setSize((int) size);

where this size value is set at line 542 in the same function:

size = evalToDouble(sldGraphic.getSize(), feature, 0);


now, the (double) size value is calculated to less than 1 (but still
greater than 0), and casting to int will turn it into 0.


I wonder what a proper fix to this issue would consist of? rounding up
size to 1?


Akos

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to