hwpfilter/source/htags.cxx     |    5 ++---
 hwpfilter/source/htags.h       |    3 ++-
 hwpfilter/source/hwpreader.cxx |    4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit f71ce9b35598d6aa64f3b095e0b3c7683948c280
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sat Feb 4 17:14:36 2023 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sat Feb 4 22:54:28 2023 +0000

    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 <caol...@redhat.com>

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{

Reply via email to