Index: _whatsnew.html
===================================================================
--- _whatsnew.html	(revision 1455)
+++ _whatsnew.html	(working copy)
@@ -71,6 +71,9 @@
 			is now enforced only when ForcePasteAsPlainText = true.</li>
 		<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1336">#1336</a>] Sometimes
 			the autogrow plugin didn't work properly in Firefox.</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>
 		<a href="_whatsnew_history.html">See previous versions history</a>
Index: editor/_source/classes/fckdomrangeiterator.js
===================================================================
--- editor/_source/classes/fckdomrangeiterator.js	(revision 1455)
+++ editor/_source/classes/fckdomrangeiterator.js	(working copy)
@@ -92,6 +92,8 @@
 		var currentNode = this._NextNode ;
 		var lastNode = this._LastNode ;
 
+		this._NextNode = null ;
+
 		while ( currentNode )
 		{
 			// closeRange indicates that a paragraph boundary has been found,
@@ -128,8 +130,15 @@
 					// The range must finish right before the boundary,
 					// 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 ;
 				}
 				else
@@ -310,7 +319,8 @@
 		// Get a reference for the next element. This is important because the
 		// 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 ;
 	}
