<div dir="ltr">Got no answer, however I've prepared a fix.<div><br></div><div><a href="https://github.com/szekerest/mapserver/commit/54dda8c1adbc4a423d0f10706e6ee0502b1c04f4">https://github.com/szekerest/mapserver/commit/54dda8c1adbc4a423d0f10706e6ee0502b1c04f4</a><br>
</div><div><br></div><div>I'd prefer to fix this problem in the stable branch too.</div><div><br></div><div>Let me know if anyone has objection to it.</div><div><br></div><div>Tamas</div><div><br></div><div><br></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-07-21 16:00 GMT+02:00 Tamas Szekeres <span dir="ltr"><<a href="mailto:szekerest@gmail.com" target="_blank">szekerest@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<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 style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap">midPoint</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-wrap">.</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-wrap">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-wrap"> </span><span 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-wrap">=</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-wrap"> </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-wrap">(</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-wrap">subStart</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-wrap">.</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-wrap">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-wrap"> </span><span 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-wrap">+</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-wrap"> </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-wrap">subEnd</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-wrap">.</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-wrap">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-wrap">)</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-wrap"> </span><span 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-wrap">*</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-wrap"> </span><span style="color:rgb(0,153,153);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap">0.5</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-wrap">;</span></div>

<div><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:18px;white-space:pre-wrap"><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>
</blockquote></div><br></div>