fixes bug 207846 "M17 FF09x [@ msvcrt.dll - nsStorageInputStream::Read] Miscellaneous non-repeatable browsing crashes" r=dbradley sr=bzbarsky

This commit is contained in:
darin%meer.net 2004-09-29 16:45:22 +00:00
Родитель 9d613072c7
Коммит ee173313aa
1 изменённых файлов: 8 добавлений и 1 удалений

Просмотреть файл

@ -313,8 +313,15 @@ nsStorageStream::Seek(PRInt32 aPosition)
mWriteCursor = mSegmentedBuffer->GetSegment(mLastSegmentNum);
NS_ASSERTION(mWriteCursor, "null mWriteCursor");
mSegmentEnd = mWriteCursor + mSegmentSize;
// Adjust write cursor for current segment offset. This test is necessary
// because SegNum may reference the next-to-be-allocated segment, in which
// case we need to be pointing at the end of the last segment.
PRInt32 segmentOffset = SegOffset(aPosition);
mWriteCursor += segmentOffset;
if (segmentOffset == 0 && (SegNum(aPosition) > (PRUint32) mLastSegmentNum))
mWriteCursor = mSegmentEnd;
else
mWriteCursor += segmentOffset;
PR_LOG(StorageStreamLog, PR_LOG_DEBUG,
("nsStorageStream [%x] Seek mWriteCursor=%x mSegmentEnd=%x\n",