[Libreoffice-commits] core.git: hwpfilter/source

Caolán McNamara caolanm at redhat.com
Fri Mar 10 10:37:44 UTC 2017


 hwpfilter/source/hbox.cxx    |    3 ---
 hwpfilter/source/hbox.h      |    7 ++-----
 hwpfilter/source/hwpread.cxx |   10 +++++-----
 3 files changed, 7 insertions(+), 13 deletions(-)

New commits:
commit 75f118da50b217956ee7a735e921524d0c2935ff
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 10 10:35:43 2017 +0000

    ofz#798 oom
    
    Change-Id: I6fa8dd999af7e00d6236a1ead5f8bb519f2d128d

diff --git a/hwpfilter/source/hbox.cxx b/hwpfilter/source/hbox.cxx
index 4977e6d..fcf1026 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 979d8a0..15c97c6 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 2cc6d31..eb27376 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)
 {


More information about the Libreoffice-commits mailing list