Index: /FCKeditor/trunk/_whatsnew.html
===================================================================
--- /FCKeditor/trunk/_whatsnew.html	(revision 1510)
+++ /FCKeditor/trunk/_whatsnew.html	(revision 1511)
@@ -91,4 +91,7 @@
 		<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1854">#1854</a>] Indentation now works inside
 			table cells.</li>
+		<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1717">#1717</a>] The editor
+			was entering on looping on some specific cases when dealing with invalid source
+			markup.</li>
 	</ul>
 	<p>
Index: /FCKeditor/trunk/editor/_source/classes/fckdomrangeiterator.js
===================================================================
--- /FCKeditor/trunk/editor/_source/classes/fckdomrangeiterator.js	(revision 1510)
+++ /FCKeditor/trunk/editor/_source/classes/fckdomrangeiterator.js	(revision 1511)
@@ -92,4 +92,6 @@
 		var currentNode = this._NextNode ;
 		var lastNode = this._LastNode ;
+
+		this._NextNode = null ;
 
 		while ( currentNode )
@@ -129,5 +131,12 @@
 					// including possibly skipped empty spaces. (#1603)
 					if ( range )
+					{
 						range.SetEnd( currentNode, 3, true ) ;
+
+						// The found boundary must be set as the next one at this
+						// point. (#1717)
+						if ( nodeName != 'br' ) 
+							this._NextNode = currentNode ;
+					}
 
 					closeRange = true ;
@@ -311,5 +320,6 @@
 		// above block can be removed or changed, so we can rely on it for the
 		// next interation.
-		this._NextNode = ( isLast || block == lastNode ) ? null : FCKDomTools.GetNextSourceNode( block, true, null, lastNode ) ;
+		if ( !this._NextNode )
+			this._NextNode = ( isLast || block == lastNode ) ? null : FCKDomTools.GetNextSourceNode( block, true, null, lastNode ) ;
 
 		return block ;
