[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - hwpfilter/source
hwpfilter/source/hwpfile.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit ae9a3581d1d1be4bc4f4da4c57d7449458f256a1 Author: Caolán McNamaraDate: Tue Feb 20 16:26:21 2018 + forcepoint #1 Thanks to Antti Levomäki and Christian Jalio from Forcepoint. Change-Id: Ic5e9a9d0f8f8d35cb6b39e68338ba029948a4ce0 Reviewed-on: https://gerrit.libreoffice.org/50084 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/hwpfilter/source/hwpfile.h b/hwpfilter/source/hwpfile.h index d58faa569a7b..3fab3a5b3dd4 100644 --- a/hwpfilter/source/hwpfile.h +++ b/hwpfilter/source/hwpfile.h @@ -227,7 +227,7 @@ class DLLEXPORT HWPFile HWPInfo& GetHWPInfo(void) { return _hwpInfo; } HWPFont& GetHWPFont(void) { return _hwpFont; } HWPStyle& GetHWPStyle(void) { return _hwpStyle; } -HWPPara *GetFirstPara(void) { return plist.front(); } +HWPPara *GetFirstPara(void) { return !plist.empty() ? plist.front() : nullptr; } EmPicture *GetEmPicture(Picture *pic); EmPicture *GetEmPictureByName(char * name); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - hwpfilter/source
hwpfilter/source/hcode.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit fb953ed10ca5a9f574d6ebf0598fb438bd3f4509 Author: Caolán McNamaraDate: Tue Feb 20 16:33:38 2018 + forcepoint #2 Thanks to Antti Levomäki and Christian Jalio from Forcepoint. Change-Id: Ie2b644a3c4c1c165334768eea73d451f07f97def Reviewed-on: https://gerrit.libreoffice.org/50082 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/hwpfilter/source/hcode.cxx b/hwpfilter/source/hcode.cxx index 41fb6d34cb81..d2eaf57bd28f 100644 --- a/hwpfilter/source/hcode.cxx +++ b/hwpfilter/source/hcode.cxx @@ -1217,6 +1217,8 @@ hchar_string hstr2ucsstr(hchar const* hstr) hchar_string kstr2hstr(unsigned char const* src) { hchar_string ret; +if (!src) +return ret; for (unsigned int i = 0; src[i] != '\0' ; i++) { if ( src[i] < 127 ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - hwpfilter/source
hwpfilter/source/hiodev.cxx | 24 +++- hwpfilter/source/hiodev.h |6 +++--- 2 files changed, 14 insertions(+), 16 deletions(-) New commits: commit bc1bf9a4fd7f75e6b7fec997d147f0f90eb8e639 Author: Caolán McNamaraDate: Fri Jan 26 11:51:43 2018 + ofz: check state in readblock and change state to a bool and reuse it more Change-Id: Iaa46004b144836431dd386a68a8ab688fd1477f2 Reviewed-on: https://gerrit.libreoffice.org/48689 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/hwpfilter/source/hiodev.cxx b/hwpfilter/source/hiodev.cxx index 4d9fdce9196c..0d299e734d9b 100644 --- a/hwpfilter/source/hiodev.cxx +++ b/hwpfilter/source/hiodev.cxx @@ -142,13 +142,11 @@ void HStreamIODev::flush() gz_flush(_gzfp, Z_FINISH); } - -int HStreamIODev::state() const +bool HStreamIODev::state() const { -return 0; +return false; } - /* zlib 관련 부분 */ bool HStreamIODev::setCompressed(bool flag) { @@ -288,16 +286,14 @@ void HMemIODev::flush() { } - -int HMemIODev::state() const +bool HMemIODev::state() const { if (pos <= length) -return 0; +return false; else -return -1; +return true; } - bool HMemIODev::setCompressed(bool ) { return false; @@ -306,7 +302,7 @@ bool HMemIODev::setCompressed(bool ) bool HMemIODev::read1b(unsigned char ) { ++pos; -if (pos <= length) +if (!state()) { out = ptr[pos - 1]; return true; @@ -326,7 +322,7 @@ bool HMemIODev::read1b(char ) bool HMemIODev::read2b(unsigned short ) { pos += 2; -if (pos <= length) +if (!state()) { out = ptr[pos - 1] << 8 | ptr[pos - 2]; return true; @@ -337,7 +333,7 @@ bool HMemIODev::read2b(unsigned short ) bool HMemIODev::read4b(unsigned int ) { pos += 4; -if (pos <= length) +if (!state()) { out = static_cast(ptr[pos - 1] << 24 | ptr[pos - 2] << 16 | ptr[pos - 3] << 8 | ptr[pos - 4]); @@ -357,6 +353,8 @@ bool HMemIODev::read4b(int ) size_t HMemIODev::readBlock(void *p, size_t size) { +if (state()) +return 0; if (length < pos + size) size = length - pos; memcpy(p, ptr + pos, size); @@ -366,7 +364,7 @@ size_t HMemIODev::readBlock(void *p, size_t size) size_t HMemIODev::skipBlock(size_t size) { -if (length < pos + size) +if (state() || length < pos + size) return 0; pos += size; return size; diff --git a/hwpfilter/source/hiodev.h b/hwpfilter/source/hiodev.h index af49703c3482..e47bd8b2d0f0 100644 --- a/hwpfilter/source/hiodev.h +++ b/hwpfilter/source/hiodev.h @@ -47,7 +47,7 @@ class DLLEXPORT HIODev virtual bool open() = 0; virtual void flush() = 0; -virtual int state() const = 0; +virtual bool state() const = 0; /* gzip routine wrapper */ virtual bool setCompressed( bool ) = 0; @@ -92,7 +92,7 @@ class HStreamIODev final: public HIODev /** * Not implemented. */ -virtual int state() const override; +virtual bool state() const override; /** * Set whether the stream is compressed or not */ @@ -144,7 +144,7 @@ class HMemIODev final: public HIODev virtual bool open() override; virtual void flush() override; -virtual int state() const override; +virtual bool state() const override; /* gzip routine wrapper */ virtual bool setCompressed( bool ) override; using HIODev::read1b; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - hwpfilter/source
hwpfilter/source/drawing.h |2 -- hwpfilter/source/hiodev.cxx |3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) New commits: commit 1d2276429aac4975bde6cc2573cf944253cc4e4b Author: Caolán McNamaraDate: Thu Aug 10 16:56:13 2017 +0100 ofz#2899 increment pos before check, like all the other cases Change-Id: Id49f747e36f767a3e82fc3610959eb94015a93d7 Reviewed-on: https://gerrit.libreoffice.org/40985 Reviewed-by: Michael Stahl Tested-by: Jenkins diff --git a/hwpfilter/source/drawing.h b/hwpfilter/source/drawing.h index 1967ddffed1c..52a67be5365d 100644 --- a/hwpfilter/source/drawing.h +++ b/hwpfilter/source/drawing.h @@ -318,8 +318,6 @@ static bool LoadCommonHeader(HWPDrawingObject * hdo, unsigned short * link_info) static HWPDrawingObject *LoadDrawingObject(void) { -fprintf(stderr, "LoadDrawingObject\n"); - HWPDrawingObject *hdo, *head, *prev; unsigned short link_info; diff --git a/hwpfilter/source/hiodev.cxx b/hwpfilter/source/hiodev.cxx index cab73a626b8f..4d9fdce9196c 100644 --- a/hwpfilter/source/hiodev.cxx +++ b/hwpfilter/source/hiodev.cxx @@ -305,9 +305,10 @@ bool HMemIODev::setCompressed(bool ) bool HMemIODev::read1b(unsigned char ) { +++pos; if (pos <= length) { -out = ptr[pos++]; +out = ptr[pos - 1]; return true; } return false; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - hwpfilter/source
hwpfilter/source/hwpread.cxx |7 +++ 1 file changed, 7 insertions(+) New commits: commit d269f530cc834507f205374727c20cc5992e2213 Author: Caolán McNamaraDate: Thu Aug 3 14:37:30 2017 +0100 ofz#2846 null deref Change-Id: I88b61d7a4faaed118db8df6f99cef08310c1f2eb Reviewed-on: https://gerrit.libreoffice.org/40725 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/hwpfilter/source/hwpread.cxx b/hwpfilter/source/hwpread.cxx index 90564df487b9..74edfda45845 100644 --- a/hwpfilter/source/hwpread.cxx +++ b/hwpfilter/source/hwpread.cxx @@ -428,6 +428,13 @@ bool Picture::Read(HWPFile & hwpf) UpdateBBox(this); if( pictype != PICTYPE_DRAW ) style.cell = reserved3; +else +{ +//picinfo.picun read above is unioned with +//picinfo.picdraw and so wrote to the hdo pointer +//value, which is definitely not useful to us +picinfo.picdraw.hdo = nullptr; +} if (follow_block_size != 0) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - hwpfilter/source
hwpfilter/source/hinfo.cxx | 18 ++ hwpfilter/source/hinfo.h| 24 hwpfilter/source/hpara.cxx |1 - hwpfilter/source/hstyle.cxx |2 +- 4 files changed, 39 insertions(+), 6 deletions(-) New commits: commit 2b22b63a6564f1c359945b653bfacfb36d4caebf Author: Markus MohrhardDate: Sun Jul 16 03:17:29 2017 +0200 don't use memset on structure with std::shared_ptr member Change-Id: Ie6033b9820435bb6a45aa70f9a48115000571e0f Reviewed-on: https://gerrit.libreoffice.org/40004 Tested-by: Jenkins Reviewed-by: Markus Mohrhard (cherry picked from commit c7fe625c8d41f648f89765abc40bb7b8fd4ed12a) Reviewed-on: https://gerrit.libreoffice.org/40009 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/hwpfilter/source/hinfo.cxx b/hwpfilter/source/hinfo.cxx index 2e5d4b1c9a16..26e2847ff048 100644 --- a/hwpfilter/source/hinfo.cxx +++ b/hwpfilter/source/hinfo.cxx @@ -194,6 +194,24 @@ bool HWPSummary::Read(HWPFile & hwpf) return (!hwpf.State()); } +ParaShape::ParaShape() +: index(0) +, left_margin(0) +, right_margin(0) +, indent(0) +, lspacing(0) +, pspacing_prev(0) +, pspacing_next(0) +, condense(0) +, arrange_type(0) +, shade(0) +, outline(0) +, outline_continue(0) +, pagebreak(0) +{ +reserved[0] = 0; +reserved[1] = 0; +} void ParaShape::Read(HWPFile & hwpf) { diff --git a/hwpfilter/source/hinfo.h b/hwpfilter/source/hinfo.h index 7adc9e94ac30..590b5f962e7c 100644 --- a/hwpfilter/source/hinfo.h +++ b/hwpfilter/source/hinfo.h @@ -242,23 +242,37 @@ struct CharShape /** * @short Tab properties */ -typedef struct +struct TabSet { unsigned char type; unsigned char dot_continue; hunit position; -} TabSet; +TabSet() +: type(0) +, dot_continue(0) +, position(0) +{ +} +}; /** * @short Column properties */ -typedef struct +struct ColumnDef { unsigned char ncols; unsigned char separator; hunit spacing; hunit columnlen, columnlen0; -} ColumnDef; +ColumnDef() +: ncols(0) +, separator(0) +, spacing(0) +, columnlen(0) +, columnlen0(0) +{ +} +}; /** * @short Style of paragraph @@ -287,6 +301,8 @@ struct ParaShape unsigned char pagebreak; void Read(HWPFile &); + +ParaShape(); }; #endif // INCLUDED_HWPFILTER_SOURCE_HINFO_H diff --git a/hwpfilter/source/hpara.cxx b/hwpfilter/source/hpara.cxx index f93e6b5c120f..397a24f84a16 100644 --- a/hwpfilter/source/hpara.cxx +++ b/hwpfilter/source/hpara.cxx @@ -79,7 +79,6 @@ HWPPara::HWPPara() , pshape(new ParaShape) { memset(cshape.get(), 0, sizeof(CharShape)); -memset(pshape.get(), 0, sizeof(ParaShape)); } HWPPara::~HWPPara() diff --git a/hwpfilter/source/hstyle.cxx b/hwpfilter/source/hstyle.cxx index 6c29a500d2b5..d43b3c8fc785 100644 --- a/hwpfilter/source/hstyle.cxx +++ b/hwpfilter/source/hstyle.cxx @@ -108,7 +108,7 @@ void HWPStyle::SetParaShape(int n, ParaShape * pshapep) if (pshapep) DATA[n].pshape = *pshapep; else -memset([n].pshape, 0, sizeof(ParaShape)); +DATA[n].pshape = ParaShape(); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - hwpfilter/source
hwpfilter/source/hinfo.h |6 +++--- hwpfilter/source/hpara.cxx |2 +- hwpfilter/source/hwpreader.cxx |2 +- 3 files changed, 5 insertions(+), 5 deletions(-) New commits: commit 893f77094139bfc2befaf4947126aae97fee137f Author: Caolán McNamaraDate: Thu Jul 6 12:25:58 2017 +0100 ofz#2452 use shared_ptr for cshape Change-Id: Icf576c08b3502ea3e24fa4b3685b55f794e844db Reviewed-on: https://gerrit.libreoffice.org/39649 Reviewed-by: Michael Stahl Tested-by: Jenkins diff --git a/hwpfilter/source/hinfo.h b/hwpfilter/source/hinfo.h index 7f1eee0657c7..7adc9e94ac30 100644 --- a/hwpfilter/source/hinfo.h +++ b/hwpfilter/source/hinfo.h @@ -23,6 +23,7 @@ #include "hwplib.h" #include "string.h" +#include #include #define CHAIN_MAX_PATH 40 @@ -282,11 +283,10 @@ struct ParaShape unsigned char outline; unsigned char outline_continue; unsigned char reserved[2]; -CharShape *cshape; - unsigned char pagebreak; +std::shared_ptr cshape; +unsigned char pagebreak; void Read(HWPFile &); -// virtual ~ParaShape(); }; #endif // INCLUDED_HWPFILTER_SOURCE_HINFO_H diff --git a/hwpfilter/source/hpara.cxx b/hwpfilter/source/hpara.cxx index f4e41c256347..f93e6b5c120f 100644 --- a/hwpfilter/source/hpara.cxx +++ b/hwpfilter/source/hpara.cxx @@ -109,7 +109,7 @@ bool HWPPara::Read(HWPFile & hwpf, unsigned char flag) if (nch && !reuse_shape) { pshape->Read(hwpf); -pshape->cshape = cshape.get(); +pshape->cshape = cshape; pshape->pagebreak = etcflag; } diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index a07afb5a058a..db4d1d3c1a90 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -1482,7 +1482,7 @@ void HwpReader::makePStyle(ParaShape * pshape) rstartEl("style:style", mxList.get()); mxList->clear(); parseParaShape(pshape); -parseCharShape(pshape->cshape); +parseCharShape(pshape->cshape.get()); rstartEl("style:properties", mxList.get()); mxList->clear(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - hwpfilter/source
hwpfilter/source/hbox.cxx|2 -- hwpfilter/source/hbox.h |2 -- hwpfilter/source/hwpfile.cxx | 10 -- hwpfilter/source/hwpread.cxx |1 + 4 files changed, 1 insertion(+), 14 deletions(-) New commits: commit 77282b66b27f8e3156b2fb68a9a3a363643ff2f8 Author: Caolán McNamaraDate: Fri Apr 21 10:51:19 2017 +0100 ofz#1193 we only set these values, never read them Change-Id: Ia2f54b536a4262e19abe260e8e19c9b15cc2d0ec Reviewed-on: https://gerrit.libreoffice.org/37761 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/hwpfilter/source/hbox.cxx b/hwpfilter/source/hbox.cxx index 3bfe57662656..ef6348817f48 100644 --- a/hwpfilter/source/hbox.cxx +++ b/hwpfilter/source/hbox.cxx @@ -328,8 +328,6 @@ FBox::FBox(hchar hch) , pgy(0) , pgno(0) , showpg(0) -, prev(nullptr) -, next(nullptr) { } diff --git a/hwpfilter/source/hbox.h b/hwpfilter/source/hbox.h index a110d70d0f32..8824a0911ded 100644 --- a/hwpfilter/source/hbox.h +++ b/hwpfilter/source/hbox.h @@ -316,8 +316,6 @@ struct FBox: public HBox short pgx, pgy; // physical xpos, ypos short pgno, showpg; // pageno where code is -FBox *prev, *next; - explicit FBox( hchar hch ); virtual ~FBox() override; }; diff --git a/hwpfilter/source/hwpfile.cxx b/hwpfilter/source/hwpfile.cxx index 729f31a9e317..00c45475fdf1 100644 --- a/hwpfilter/source/hwpfile.cxx +++ b/hwpfilter/source/hwpfile.cxx @@ -466,18 +466,8 @@ EmPicture *HWPFile::GetEmPictureByName(char * name) return nullptr; } - void HWPFile::AddBox(FBox * box) { -// LATER if we don't use box->next(), -// AddBox() and GetBoxHead() are useless; -if (!blist.empty()) -{ -box->prev = blist.back(); -box->prev->next = box; -} -else -box->prev = nullptr; blist.push_back(box); } diff --git a/hwpfilter/source/hwpread.cxx b/hwpfilter/source/hwpread.cxx index 92f484b1d10d..90564df487b9 100644 --- a/hwpfilter/source/hwpread.cxx +++ b/hwpfilter/source/hwpread.cxx @@ -219,6 +219,7 @@ bool TxtBox::Read(HWPFile & hwpf) hwpf.AddBox(this); hwpf.Read2b(_len, 1); hwpf.Read2b(, 1); +unsigned short next; hwpf.Read2b(, 1); hwpf.Read2b(, 1); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits