From f242f7249ee689ab61f00498dc17d13c9849ee5a Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 24 Feb 2022 10:16:00 +0000 Subject: ofz#44997 Use-of-uninitialized-value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I3803232ddc7346967e22770ae2bdbc3378779f8b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130488 Tested-by: Jenkins Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130458 Reviewed-by: Michael Stahl --- hwpfilter/source/hinfo.cxx | 12 ++++++++++++ hwpfilter/source/hinfo.h | 2 ++ hwpfilter/source/hpara.cxx | 2 -- hwpfilter/source/hstyle.cxx | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) (limited to 'hwpfilter/source') 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()) , pshape(std::make_shared()) { - 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(); - 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(); } } -- cgit