summaryrefslogtreecommitdiff
path: root/hwpfilter/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2023-02-04 17:14:36 +0000
committerCaolán McNamara <caolanm@redhat.com>2023-02-04 22:54:28 +0000
commitf71ce9b35598d6aa64f3b095e0b3c7683948c280 (patch)
treefc140f4b1d5b79442b353ee7d121e5d7adbf2f1a /hwpfilter/source
parenta21aad5e084e3901a1e216ef9006b0f8b6132c39 (diff)
ofz: Use-of-uninitialized-value
Change-Id: I97fb4edcad3a014b622f1a936adecd634121ad3f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146559 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'hwpfilter/source')
-rw-r--r--hwpfilter/source/htags.cxx5
-rw-r--r--hwpfilter/source/htags.h3
-rw-r--r--hwpfilter/source/hwpreader.cxx4
3 files changed, 6 insertions, 6 deletions
diff --git a/hwpfilter/source/htags.cxx b/hwpfilter/source/htags.cxx
index 51fbd9b539a2..69d0398ca952 100644
--- a/hwpfilter/source/htags.cxx
+++ b/hwpfilter/source/htags.cxx
@@ -52,9 +52,8 @@ bool HyperText::Read(HWPFile& hwpf)
EmPicture::EmPicture(size_t tsize)
: size(tsize >= 32 ? tsize - 32 : 0)
+ , data(size, 0)
{
- if (size != 0)
- data.reset( new uchar[size] );
}
EmPicture::~EmPicture()
@@ -70,7 +69,7 @@ bool EmPicture::Read(HWPFile & hwpf)
name[0] = 'H';
name[1] = 'W';
name[2] = 'P';
- return hwpf.ReadBlock(data.get(), size) != 0;
+ return hwpf.ReadBlock(data.data(), size) != 0;
}
diff --git a/hwpfilter/source/htags.h b/hwpfilter/source/htags.h
index 0a302bf188af..d662a002ecb3 100644
--- a/hwpfilter/source/htags.h
+++ b/hwpfilter/source/htags.h
@@ -21,6 +21,7 @@
#define INCLUDED_HWPFILTER_SOURCE_HTAGS_H
#include <memory>
+#include <vector>
#ifdef _WIN32
#include <objidl.h>
#endif
@@ -34,7 +35,7 @@ struct EmPicture
size_t size;
char name[16];
char type[16];
- std::unique_ptr<uchar[]> data;
+ std::vector<uchar> data;
explicit EmPicture(size_t size);
~EmPicture(void);
diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx
index 3cab4cb9ba72..302ebf7599f8 100644
--- a/hwpfilter/source/hwpreader.cxx
+++ b/hwpfilter/source/hwpreader.cxx
@@ -510,7 +510,7 @@ void HwpReader::makeDrawMiscStyle( HWPDrawingObject *hdo )
if (emp)
{
startEl("office:binary-data");
- chars(base64_encode_string(emp->data.get(), emp->size));
+ chars(base64_encode_string(emp->data.data(), emp->size));
endEl("office:binary-data");
}
endEl("draw:fill-image");
@@ -3824,7 +3824,7 @@ void HwpReader::makePicture(Picture * hbox)
EmPicture *emp = hwpfile.GetEmPicture(hbox);
if( emp )
{
- chars(base64_encode_string(emp->data.get(), emp->size));
+ chars(base64_encode_string(emp->data.data(), emp->size));
}
}
else{