Kaydet (Commit) 005ad924 authored tarafından Caolán McNamara's avatar Caolán McNamara

hwp fuzzing timeout

Change-Id: I88656c558dfe1ef6e701ba54633bfe251bc4e279
Reviewed-on: https://gerrit.libreoffice.org/43884Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst e027d295
......@@ -444,17 +444,18 @@ bool Picture::Read(HWPFile & hwpf)
//read potentially compressed data in blocks as its more
//likely large values are simply broken and we'll run out
//of data before we need to realloc
for (size_t i = 0; i < follow_block_size; i+= SAL_MAX_UINT16)
unsigned char buffer[SAL_MAX_UINT16];
for (size_t i = 0; i < follow_block_size; i+= SAL_N_ELEMENTS(buffer))
{
size_t nOldSize = follow.size();
size_t nBlock = std::min<size_t>(SAL_MAX_UINT16, follow_block_size - nOldSize);
follow.resize(nOldSize + nBlock);
size_t nReadBlock = hwpf.Read1b(follow.data() + nOldSize, nBlock);
if (nBlock != nReadBlock)
size_t nBlock = std::min(SAL_N_ELEMENTS(buffer), follow_block_size - nOldSize);
size_t nReadBlock = hwpf.Read1b(buffer, nBlock);
if (nReadBlock)
{
follow.resize(nOldSize + nReadBlock);
break;
follow.insert(follow.end(), buffer, buffer + nReadBlock);
}
if (nBlock != nReadBlock)
break;
}
follow_block_size = follow.size();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment