summaryrefslogtreecommitdiff
path: root/hwpfilter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-02-24 10:16:00 +0000
committerMichael Stahl <michael.stahl@allotropia.de>2022-03-01 18:39:58 +0100
commitf242f7249ee689ab61f00498dc17d13c9849ee5a (patch)
tree506c4fcb67da49e9687b3e346b5512856f10b85d /hwpfilter
parent69ac100f537c33de80ed451288120028b0914e94 (diff)
ofz#44997 Use-of-uninitialized-value
Change-Id: I3803232ddc7346967e22770ae2bdbc3378779f8b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130488 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130458 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'hwpfilter')
-rw-r--r--hwpfilter/qa/cppunit/data/pass/ofz44997-1.hwp1
-rw-r--r--hwpfilter/source/hinfo.cxx12
-rw-r--r--hwpfilter/source/hinfo.h2
-rw-r--r--hwpfilter/source/hpara.cxx2
-rw-r--r--hwpfilter/source/hstyle.cxx2
5 files changed, 16 insertions, 3 deletions
diff --git a/hwpfilter/qa/cppunit/data/pass/ofz44997-1.hwp b/hwpfilter/qa/cppunit/data/pass/ofz44997-1.hwp
new file mode 100644
index 000000000000..76a8e05ee452
--- /dev/null
+++ b/hwpfilter/qa/cppunit/data/pass/ofz44997-1.hwp
@@ -0,0 +1 @@
+HWP Document File V3.00  bf```082  \ No newline at end of file
diff --git a/hwpfilter/source/hinfo.cxx b/hwpfilter/source/hinfo.cxx
index bc1d61021d99..f842f0d683ff 100644
--- a/hwpfilter/source/hinfo.cxx
+++ b/hwpfilter/source/hinfo.cxx
@@ -258,6 +258,18 @@ void ParaShape::Read(HWPFile & hwpf)
hwpf.ReadBlock(reserved, 2);
}
+CharShape::CharShape()
+ : index(0)
+ , size(0)
+ , font{0}
+ , ratio{0}
+ , space{0}
+ , color{0}
+ , shade(0)
+ , attr(0)
+ , reserved{0}
+{
+}
void CharShape::Read(HWPFile & hwpf)
{
diff --git a/hwpfilter/source/hinfo.h b/hwpfilter/source/hinfo.h
index c415783e26a2..c0381787f7d9 100644
--- a/hwpfilter/source/hinfo.h
+++ b/hwpfilter/source/hinfo.h
@@ -228,6 +228,8 @@ struct CharShape
unsigned char reserved[4];
void Read(HWPFile &);
+
+ CharShape();
};
/* ?? ?????? ???? ?????? */
diff --git a/hwpfilter/source/hpara.cxx b/hwpfilter/source/hpara.cxx
index 415c8e984eb3..510a1676ebc3 100644
--- a/hwpfilter/source/hpara.cxx
+++ b/hwpfilter/source/hpara.cxx
@@ -78,7 +78,6 @@ HWPPara::HWPPara()
, cshape(std::make_shared<CharShape>())
, pshape(std::make_shared<ParaShape>())
{
- memset(cshape.get(), 0, sizeof(CharShape));
}
HWPPara::~HWPPara()
@@ -145,7 +144,6 @@ bool HWPPara::Read(HWPFile & hwpf, unsigned char flag)
for (ii = 0; ii < nch; ii++)
{
cshapep[ii] = std::make_shared<CharShape>();
- memset(cshapep[ii].get(), 0, sizeof(CharShape));
unsigned char same_cshape(0);
hwpf.Read1b(same_cshape);
diff --git a/hwpfilter/source/hstyle.cxx b/hwpfilter/source/hstyle.cxx
index 33f143440c32..c3fb787ecd38 100644
--- a/hwpfilter/source/hstyle.cxx
+++ b/hwpfilter/source/hstyle.cxx
@@ -99,7 +99,7 @@ void HWPStyle::SetCharShape(int n, CharShape const* cshapep)
if (cshapep)
DATA[n].cshape = *cshapep;
else
- memset(&DATA[n].cshape, 0, sizeof(CharShape));
+ DATA[n].cshape = CharShape();
}
}