diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-03-10 10:35:43 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-03-10 10:36:47 +0000 |
commit | 75f118da50b217956ee7a735e921524d0c2935ff (patch) | |
tree | 8f6b113e6a4f732e77c3a51227ba88f9d95d243a | |
parent | 1353ebe535732022aef4377030d86ad7153c3144 (diff) |
ofz#798 oom
Change-Id: I6fa8dd999af7e00d6236a1ead5f8bb519f2d128d
-rw-r--r-- | hwpfilter/source/hbox.cxx | 3 | ||||
-rw-r--r-- | hwpfilter/source/hbox.h | 7 | ||||
-rw-r--r-- | hwpfilter/source/hwpread.cxx | 10 |
3 files changed, 7 insertions, 13 deletions
diff --git a/hwpfilter/source/hbox.cxx b/hwpfilter/source/hbox.cxx index 4977e6dbf9b3..fcf1026179e1 100644 --- a/hwpfilter/source/hbox.cxx +++ b/hwpfilter/source/hbox.cxx @@ -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) { } diff --git a/hwpfilter/source/hbox.h b/hwpfilter/source/hbox.h index 979d8a07f3d6..15c97c6363f4 100644 --- a/hwpfilter/source/hbox.h +++ b/hwpfilter/source/hbox.h @@ -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 { diff --git a/hwpfilter/source/hwpread.cxx b/hwpfilter/source/hwpread.cxx index 2cc6d3185ce7..eb27376cdc77 100644 --- a/hwpfilter/source/hwpread.cxx +++ b/hwpfilter/source/hwpread.cxx @@ -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) { |