mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
fix:add a protection to check memory overflow.
This commit is contained in:
parent
6318366a10
commit
c3db39499b
6
mdx.cc
6
mdx.cc
|
@ -165,6 +165,12 @@ public:
|
|||
const char * indexEntryPtr = chunks.getBlock( links[ 0 ].articleOffset, chunk );
|
||||
memcpy( &indexEntry, indexEntryPtr, sizeof( indexEntry ) );
|
||||
|
||||
//corrupted file or broken entry.
|
||||
if (indexEntry.decompressedBlockSize < indexEntry.recordOffset + indexEntry.recordSize)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ScopedMemMap compressed( mddFile, indexEntry.compressedBlockPos, indexEntry.compressedBlockSize );
|
||||
if ( !compressed.startAddress() )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue