ofz#798 oom

Change-Id: I6fa8dd999af7e00d6236a1ead5f8bb519f2d128d
This commit is contained in:
Caolán McNamara
2017-03-10 10:35:43 +00:00
parent 1353ebe535
commit 75f118da50
3 changed files with 7 additions and 13 deletions

View File

@@ -77,9 +77,6 @@ hchar_string HBox::GetString()
// skip block
SkipData::SkipData(hchar hch)
: HBox(hch)
, data_block_len(0)
, dummy(0)
, data_block(nullptr)
{
}

View File

@@ -68,18 +68,15 @@ struct HBox
};
/**
* @short Class for saving data to be skipped.
* @short Class for skipping data.
*/
struct SkipData: public HBox
{
uint data_block_len;
hchar dummy;
std::unique_ptr<char[]> data_block;
explicit SkipData(hchar);
virtual ~SkipData() override;
virtual bool Read(HWPFile &hwpf) override;
};
struct DateCode;
struct FieldCode : public HBox
{

View File

@@ -45,19 +45,19 @@ bool HBox::Read(HWPFile & )
bool SkipData::Read(HWPFile & hwpf)
{
uint data_block_len;
hwpf.Read4b(&data_block_len, 1);
hchar dummy;
hwpf.Read2b(&dummy, 1);
if (!(IS_SP_SKIP_BLOCK(hh) && (hh == dummy))){
return hwpf.SetState(HWP_InvalidFileFormat);
}
}
data_block.reset(new char[data_block_len]);
return hwpf.Read1b(data_block.get(), data_block_len);
return hwpf.SkipBlock(data_block_len);
}
// Field code(5)
bool FieldCode::Read(HWPFile & hwpf)
{