<div dir="ltr">Hi Devs,<div><br></div><div>Reprojecting a "very big" rectangle (for example zooming out too far) may lead to infinite loop in msProjectSegment.</div><div><br></div><div>In my case the while loop in mapproject.c line 248-261 causes the issue, where</div>
<div><br></div><div><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre">midPoint</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre">.</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre">y</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="font-weight:bold;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre">=</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre">(</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre">subStart</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre">.</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre">y</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="font-weight:bold;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre">+</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre">subEnd</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre">.</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre">y</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre">)</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="font-weight:bold;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre">*</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(0,153,153);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre">0.5</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre">;</span></div>
<div><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre"><br></span></div>yields the same result as the initial subEnd.y and since the projection is failing, the loop condition will never change.<div>
<br></div><div>What would be the reasonable solution for this issue? </div><div>May I think that returning immediately with an error if the loop condition is not changing would be ok?</div><div><br></div><div>I would also think that bringing back the former msProjectRectTraditionalEdge instead of msProjectRectAsPolygon (in msProjectRect) would also be reasonable in some conditions. msProjectRectAsPolygon may be very inefficient regarding to the performance.</div>
<div><br></div><div><br></div><div>Best regards,</div><div><br></div><div>Tamas</div></div>