diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-08-28 13:04:03 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-08-28 16:57:48 +0200 |
commit | 474178acd10a87727ff63f9f5c0bc73d71520af7 (patch) | |
tree | 6b17e355d640e8cad4c941112f679fa53c87cd37 /hwpfilter/source/hpara.cxx | |
parent | 32e07ada197fb135ae78ee2b7c0c598a356bfabe (diff) |
ofz#3174 disallow header in header
Change-Id: I509fbfe5d7c319f0515896ecfca4183113eef764
Reviewed-on: https://gerrit.libreoffice.org/41635
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'hwpfilter/source/hpara.cxx')
-rw-r--r-- | hwpfilter/source/hpara.cxx | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/hwpfilter/source/hpara.cxx b/hwpfilter/source/hpara.cxx index 6b43c3bbf827..7739b9cd0a85 100644 --- a/hwpfilter/source/hpara.cxx +++ b/hwpfilter/source/hpara.cxx @@ -229,7 +229,8 @@ std::unique_ptr<HBox> HWPPara::readHBox(HWPFile & hwpf) hbox.reset(new Hidden); break; case CH_HEADER_FOOTER: // 16 - hbox.reset(new HeaderFooter); + if (!hwpf.already_importing_type(CH_HEADER_FOOTER)) + hbox.reset(new HeaderFooter); break; case CH_FOOTNOTE: // 17 hbox.reset(new Footnote); @@ -274,11 +275,19 @@ std::unique_ptr<HBox> HWPPara::readHBox(HWPFile & hwpf) break; } } - if (!hbox || !hbox->Read(hwpf)) + + if (!hbox) + return nullptr; + + hwpf.push_hpara_type(scflag); + bool bRead = hbox->Read(hwpf); + hwpf.pop_hpara_type(); + if (!bRead) { hbox.reset(); - return hbox; + return nullptr; } + if( hh == CH_TEXT_BOX || hh == CH_PICTURE || hh == CH_LINE ) { FBox *fbox = static_cast<FBox *>(hbox.get()); |