Fix converter stream part of bug 638236. r=bzbarsky a1.9.2.16=clegnitto
authorL. David Baron <dbaron@dbaron.org>
Wed, 02 Mar 2011 21:01:20 -0800
changeset 34972 925f4985ee729dbda580c789614f7913cdadc482
parent 34971 eaca9531b26317cbea5d00f5a53169bbd034bdc5
child 34973 11cf54bab5f98656e40e7fa46466c8449ed3b9ee
push id1846
push userdbaron@mozilla.com
push dateTue, 08 Mar 2011 00:52:21 +0000
reviewersbzbarsky
bugs638236
milestone1.9.2.16pre
Fix converter stream part of bug 638236. r=bzbarsky a1.9.2.16=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)