diff --git a/xpcom/io/nsStorageStream.cpp b/xpcom/io/nsStorageStream.cpp index 93dbade82e9..08e4e299cca 100644 --- a/xpcom/io/nsStorageStream.cpp +++ b/xpcom/io/nsStorageStream.cpp @@ -458,9 +458,10 @@ nsStorageInputStream::ReadSegments(nsWriteSegmentFun writer, void * closure, PRU PRUint32 available = mStorageStream->mLogicalLength - mLogicalCursor; if (!available) goto out; - + mReadCursor = mStorageStream->mSegmentedBuffer->GetSegment(mSegmentNum++); mSegmentEnd = mReadCursor + PR_MIN(mSegmentSize, available); + availableInSegment = mSegmentEnd - mReadCursor; } count = PR_MIN(availableInSegment, remainingCapacity);