Skip to content

Commit

Permalink
Revert "ZipFile: Added an assertion to catch a write past end of buffer"
Browse files Browse the repository at this point in the history
This reverts commit f646bb9.
  • Loading branch information
danij-deng committed May 21, 2012
1 parent 13514db commit 0f0279d
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions doomsday/engine/portable/src/zipfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,15 +796,12 @@ boolean ZipFile_UncompressRaw(uint8_t* in, size_t inSize, uint8_t* out, size_t o
}

static size_t ZipFile_BufferLump(ZipFile* zip, const zipfile_lumprecord_t* lumpRecord,
uint8_t* buffer, size_t bufferSize)
uint8_t* buffer)
{
assert(zip && lumpRecord && buffer);

DFile_Seek(zip->base._file, lumpRecord->baseOffset, SEEK_SET);

// Must have enough room in the buffer.
assert(bufferSize >= lumpRecord->info.size);

if(lumpRecord->info.compressedSize != lumpRecord->info.size)
{
boolean result;
Expand All @@ -814,11 +811,8 @@ static size_t ZipFile_BufferLump(ZipFile* zip, const zipfile_lumprecord_t* lumpR

// Read the compressed data into a temporary buffer for decompression.
DFile_Read(zip->base._file, compressedData, lumpRecord->info.compressedSize);

// Uncompress into the buffer provided by the caller.
result = ZipFile_UncompressRaw(compressedData, lumpRecord->info.compressedSize,
buffer, lumpRecord->info.size);

free(compressedData);
if(!result) return 0; // Inflate failed.
}
Expand Down Expand Up @@ -875,7 +869,7 @@ size_t ZipFile_ReadLumpSection2(ZipFile* zip, int lumpIdx, uint8_t* buffer,
}

VERBOSE2( Con_Printf("\n") )
return ZipFile_BufferLump(zip, lumpRecord, buffer, length);
return ZipFile_BufferLump(zip, lumpRecord, buffer);
}

size_t ZipFile_ReadLumpSection(ZipFile* zip, int lumpIdx, uint8_t* buffer,
Expand Down

0 comments on commit 0f0279d

Please sign in to comment.