divyang4481 / lz4

Automatically exported from code.google.com/p/lz4
0 stars 0 forks source link

LZ4_compressHC Crashes #57

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Using the latest checkout LZ4_compressHC crashes. Attached is call stack.
Crash is memory management related.

OS: Windows
Compiler : Visual Studio 2012

Usage of LZ4_compressHC:

void CompressData(){
    for(int i = 0;i != DataTable.size();i++){
        if(DataTable[i].Compressed){
        char* Working = (char*)DataTable[i].Data;
        char* CompressTarget = new char[DataTable[i].Size];
        DataTable[i].CommitSize = LZ4_compressHC (Working, CompressTarget, DataTable[i].Size);
        DataTable[i].UpdateTarget->CompressedSize = DataTable[i].CommitSize;
        DataTable[i].Data = (unsigned char*)CompressTarget;
        delete[] Working;
        }
    }
}

Original issue reported on code.google.com by ren...@hotmail.com on 1 Jan 2013 at 12:25

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Never mind i wasn't allocating enough for the output buffer. Everything seems 
to be working fine if i use LZ4_compressBound on the input buffer to determine 
output buffer size.

Original comment by ren...@hotmail.com on 1 Jan 2013 at 1:30

GoogleCodeExporter commented 9 years ago
Closed as requested

Original comment by yann.col...@gmail.com on 1 Jan 2013 at 11:18