Fix converter stream part of bug 638236. r=bzbarsky a1.9.1.18=clegnitto
authorL. David Baron <dbaron@dbaron.org>
Wed, 02 Mar 2011 21:01:20 -0800
changeset 27350 8c11daae5821ff6090180b9dd057fb8778851385
parent 27349 f51e2d406a0c6a03516151f2c72c67d8a558da53
child 27351 facd39641206b6851f9065ee8877e3d674ff3496
push id2685
push userdbaron@mozilla.com
push dateTue, 08 Mar 2011 00:53:43 +0000
reviewersbzbarsky
bugs638236
milestone1.9.1.18pre
Fix converter stream part of bug 638236. r=bzbarsky a1.9.1.18=clegnitto
intl/uconv/src/nsConverterInputStream.cpp
--- a/intl/uconv/src/nsConverterInputStream.cpp
+++ b/intl/uconv/src/nsConverterInputStream.cpp
@@ -249,17 +249,18 @@ nsConverterInputStream::Fill(nsresult * 
       // XXX this is needed to make sure we don't underrun our buffer;
       // bug 160784 again
       srcConsumed = PR_MAX(srcConsumed, 0);
       mConverter->Reset();
     }
     NS_ASSERTION(srcConsumed <= mByteData->GetLength(),
                  "Whoa.  The converter should have returned NS_OK_UDEC_MOREINPUT before this point!");
   } while (mReplacementChar &&
-           NS_FAILED(*aErrorCode));
+           NS_FAILED(*aErrorCode) &&
+           mUnicharData->GetBufferSize() > mUnicharDataLength);
 
   mLeftOverBytes = mByteData->GetLength() - srcConsumed;
 
   return mUnicharDataLength;
 }
 
 NS_IMETHODIMP
 nsConverterInputStream::ReadLine(nsAString& aLine, PRBool* aResult)