fpicker/source/office/fileview.cxx | 10 + hwpfilter/source/drawing.h | 13 +- hwpfilter/source/hcode.cxx | 2 hwpfilter/source/htags.cxx | 26 ++--- hwpfilter/source/hwpfile.cxx | 7 + hwpfilter/source/hwpfile.h | 6 + hwpfilter/source/hwpread.cxx | 21 ++-- hwpfilter/source/hwpreader.cxx | 78 ++++----------- sc/inc/documentimport.hxx | 2 sc/inc/table.hxx | 2 sc/source/core/data/document.cxx | 12 +- sc/source/core/data/documentimport.cxx | 14 ++ sc/source/core/data/table2.cxx | 15 ++ sc/source/filter/lotus/op.cxx | 11 -- sc/source/filter/oox/sheetdatabuffer.cxx | 16 ++- shell/source/win32/SysShExec.cxx | 8 + svtools/source/dialogs/ServerDetailsControls.cxx | 2 sw/source/filter/ww8/wrtw8sty.cxx | 28 ++--- sw/source/filter/ww8/wrtww8.hxx | 4 vcl/source/fontsubset/sft.cxx | 12 +- vcl/source/fontsubset/ttcr.cxx | 35 +++++- vcl/source/outdev/hatch.cxx | 7 + writerfilter/source/dmapper/DomainMapperTableManager.cxx | 2 23 files changed, 208 insertions(+), 125 deletions(-)
New commits: commit bc8b0f5a6dcb5758def46da50d5c1c7110fac3ac Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Mar 1 10:18:51 2022 +0000 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Thu Aug 11 05:49:42 2022 +0200 ofz: don't register style if hbox load failed Change-Id: I4d9d5d76f0c2385871003720e933ed1926f66c70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130771 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Jenkins (cherry picked from commit 3ac009bfec614ece98313c6444b4c1183ff14954) diff --git a/hwpfilter/source/hwpread.cxx b/hwpfilter/source/hwpread.cxx index bdb3855f437b..b90e1b635818 100644 --- a/hwpfilter/source/hwpread.cxx +++ b/hwpfilter/source/hwpread.cxx @@ -234,7 +234,6 @@ bool TxtBox::Read(HWPFile & hwpf) hwpf.Read2b(&option, 1); hwpf.Read2b(&ctrl_ch, 1); hwpf.Read2b(style.margin, 12); - hwpf.AddFBoxStyle(&style); hwpf.Read2b(&box_xs, 1); hwpf.Read2b(&box_ys, 1); hwpf.Read2b(&cap_xs, 1); @@ -362,7 +361,10 @@ bool TxtBox::Read(HWPFile & hwpf) else m_pTable = nullptr; - return !hwpf.State(); + bSuccess = !hwpf.State(); + if (bSuccess) + hwpf.AddFBoxStyle(&style); + return bSuccess; } namespace @@ -510,12 +512,14 @@ bool Picture::Read(HWPFile & hwpf) style.boxtype = 'G'; else style.boxtype = 'D'; - hwpf.AddFBoxStyle(&style); // caption hwpf.ReadParaList(caption); - return !hwpf.State(); + bool bSuccess = !hwpf.State(); + if (bSuccess) + hwpf.AddFBoxStyle(&style); + return bSuccess; } // line(15) @@ -553,7 +557,6 @@ bool Line::Read(HWPFile & hwpf) hwpf.Read2b(&option, 1); hwpf.Read2b(&ctrl_ch, 1); hwpf.Read2b(style.margin, 12); - hwpf.AddFBoxStyle(&style); hwpf.Read2b(&box_xs, 1); hwpf.Read2b(&box_ys, 1); hwpf.Read2b(&cap_xs, 1); @@ -582,7 +585,10 @@ bool Line::Read(HWPFile & hwpf) hwpf.Read2b(&color, 1); style.xpos = width; - return !hwpf.State(); + bool bSuccess = !hwpf.State(); + if (bSuccess) + hwpf.AddFBoxStyle(&style); + return bSuccess; } // hidden(15) commit c144a726f1500ecf53adc7e9ef1aab926cbeafec Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Mar 1 09:35:34 2022 +0000 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Thu Aug 11 05:49:05 2022 +0200 ofz: glyph data must be at least 10 bytes long to be useful Change-Id: I312c33c598013feced15c6f2dbcc66e493b703e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130767 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Jenkins (cherry picked from commit b228045cf3fb50128fd40a8f26376443ad22f874) diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx index d4ff5f413ede..86dc02206e92 100644 --- a/vcl/source/fontsubset/ttcr.cxx +++ b/vcl/source/fontsubset/ttcr.cxx @@ -1270,7 +1270,7 @@ static void ProcessTables(TrueTypeCreator *tt) /* printf("IDs: %d %d.\n", gd->glyphID, gd->newID); */ - if (gd->nbytes != 0) { + if (gd->nbytes >= 10) { sal_Int16 z = GetInt16(gd->ptr, 2); if (z < xMin) xMin = z; commit cf7e029434be7f546679581d9c75110c6d4ebece Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Feb 28 21:12:07 2022 +0000 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Thu Aug 11 05:48:34 2022 +0200 ofz: measure maximum possible contours Change-Id: Ie039abd835fef06514edde12b99e17360f5481a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130774 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 26abdb564dad2011a298fc1253279232cb8b59cf) diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index c505b43c0344..e82f37e533a1 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -349,7 +349,13 @@ static int GetSimpleTTOutline(AbstractTrueTypeFont const *ttf, sal_uInt32 glyphI if (glyphID >= ttf->glyphCount()) return 0; - const sal_uInt8* ptr = table + ttf->glyphOffset(glyphID); + sal_uInt32 nGlyphOffset = ttf->glyphOffset(glyphID); + if (nGlyphOffset > nTableSize) + return 0; + + const sal_uInt8* ptr = table + nGlyphOffset; + const sal_uInt32 nMaxGlyphSize = nTableSize - nGlyphOffset; + const sal_Int16 numberOfContours = GetInt16(ptr, GLYF_numberOfContours_offset); if( numberOfContours <= 0 ) /*- glyph is not simple */ return 0; @@ -364,7 +370,7 @@ static int GetSimpleTTOutline(AbstractTrueTypeFont const *ttf, sal_uInt32 glyphI /* determine the last point and be extra safe about it. But probably this code is not needed */ sal_uInt16 lastPoint=0; - const sal_Int32 nMaxContours = (nTableSize - 10)/2; + const sal_Int32 nMaxContours = (nMaxGlyphSize - 10)/2; if (numberOfContours > nMaxContours) return 0; for (i=0; i<numberOfContours; i++) commit cc6b572e6ba9a8714a57cdfeadb3c24ab1844ffc Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Feb 25 12:33:13 2022 +0000 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Thu Aug 11 05:45:31 2022 +0200 lastPoint might be 0xFFFF LIBREOFFICE-KYYAZMB9 Change-Id: Ic0d95bd39a01dc1e5e0fec83dcc2c40b3f23b747 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130462 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> (cherry picked from commit 21ea1eacd214dbaac8d0ce7f437580d535871415) diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 9fcf26f97d9c..c505b43c0344 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -381,7 +381,7 @@ static int GetSimpleTTOutline(AbstractTrueTypeFont const *ttf, sal_uInt32 glyphI const sal_uInt8* p = ptr + nOffset; const sal_uInt32 nBytesRemaining = nTableSize - nOffset; - const sal_uInt16 palen = lastPoint+1; + const sal_uInt32 palen = lastPoint+1; //at a minimum its one byte per entry if (palen > nBytesRemaining || lastPoint > nBytesRemaining-1) commit d60b804314ab9d75dd9fb40babf71c56e89f3354 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Mar 1 10:39:34 2022 +0000 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Thu Aug 11 05:44:53 2022 +0200 fail more gracefully if m_aTmpPosition is empty LIBREOFFICE-N4LA0OHZ Change-Id: I7f863151f753ad5605c4f1f280cfd79aa4c6bce4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130772 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 02837024ea8d3d52c92420858327b309f2e96487) diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index 6548bd95b656..ab8338b04914 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -547,6 +547,8 @@ void DomainMapperTableManager::endOfRowAction() // Compare the table position and style with the previous ones. We may need to split // into two tables if those are different. We surely don't want to do anything // if we don't have any row yet. + if (m_aTmpPosition.empty()) + throw std::out_of_range("row without a position"); TablePositionHandlerPtr pTmpPosition = m_aTmpPosition.back(); TablePropertyMapPtr pTablePropMap = m_aTmpTableProperties.back( ); TablePositionHandlerPtr pCurrentPosition = m_aTablePositions.back(); commit a8dd98cc140f37e790f2b40ef31a5321d888c63e Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sun Feb 27 21:17:52 2022 +0000 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Thu Aug 11 05:44:12 2022 +0200 ofz#44991 keep paragraph's that failed to load until import is complete to avoid dangling references to them Change-Id: Ic8710f63a8cf6a6a665348c7c84bf0b43f0e2c83 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130643 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 4836ac408b04225b66246671e29a54cd0d6703cf) diff --git a/hwpfilter/source/drawing.h b/hwpfilter/source/drawing.h index 935b33171c15..ff389876c4d2 100644 --- a/hwpfilter/source/drawing.h +++ b/hwpfilter/source/drawing.h @@ -315,7 +315,7 @@ static bool LoadCommonHeader(HWPDrawingObject * hdo, unsigned short * link_info) return hmem->skipBlock(size - common_size ) != 0; } -static std::unique_ptr<HWPDrawingObject> LoadDrawingObject(void) +static std::unique_ptr<HWPDrawingObject> LoadDrawingObject(HWPFile& hwpf) { HWPDrawingObject *prev = nullptr; std::unique_ptr<HWPDrawingObject> hdo, head; @@ -354,7 +354,7 @@ static std::unique_ptr<HWPDrawingObject> LoadDrawingObject(void) } if (link_info & HDOFILE_HAS_CHILD) { - hdo->child = LoadDrawingObject(); + hdo->child = LoadDrawingObject(hwpf); if (hdo->child == nullptr) { goto error; @@ -383,6 +383,11 @@ error: { hdo->type = HWPDO_RECT; } + if (hdo->property.pPara) + { + hwpf.move_to_failed(std::unique_ptr<HWPPara>(hdo->property.pPara)); + hdo->property.pPara = nullptr; + } HWPDOFunc(hdo.get(), OBJFUNC_FREE, nullptr, 0); hdo.reset(); @@ -396,7 +401,7 @@ error: } -static bool LoadDrawingObjectBlock(Picture * pic) +static bool LoadDrawingObjectBlock(Picture * pic, HWPFile& hwpf) { int size; if (!hmem->read4b(size)) @@ -422,7 +427,7 @@ static bool LoadDrawingObjectBlock(Picture * pic) !hmem->skipBlock(size - HDOFILE_HEADER_SIZE)) return false; - pic->picinfo.picdraw.hdo = LoadDrawingObject().release(); + pic->picinfo.picdraw.hdo = LoadDrawingObject(hwpf).release(); if (pic->picinfo.picdraw.hdo == nullptr) return false; return true; diff --git a/hwpfilter/source/hwpfile.cxx b/hwpfilter/source/hwpfile.cxx index 13ce581b2266..96fb79e4f621 100644 --- a/hwpfilter/source/hwpfile.cxx +++ b/hwpfilter/source/hwpfile.cxx @@ -244,7 +244,7 @@ void HWPFile::ReadParaList(std::vector < HWPPara* > &aplist) aplist.push_back(spNode.release()); spNode.reset( new HWPPara ); } - pfailedlist.push_back(std::move(spNode)); + move_to_failed(std::move(spNode)); } void HWPFile::ReadParaList(std::vector< std::unique_ptr<HWPPara> > &aplist, unsigned char flag) @@ -278,7 +278,12 @@ void HWPFile::ReadParaList(std::vector< std::unique_ptr<HWPPara> > &aplist, unsi aplist.push_back(std::move(spNode)); spNode.reset( new HWPPara ); } - pfailedlist.push_back(std::move(spNode)); + move_to_failed(std::move(spNode)); +} + +void HWPFile::move_to_failed(std::unique_ptr<HWPPara> xPara) +{ + pfailedlist.push_back(std::move(xPara)); } void HWPFile::TagsRead() diff --git a/hwpfilter/source/hwpfile.h b/hwpfilter/source/hwpfile.h index f5f30d925416..f7121b6b1757 100644 --- a/hwpfilter/source/hwpfile.h +++ b/hwpfilter/source/hwpfile.h @@ -256,6 +256,8 @@ class DLLEXPORT HWPFile } void pop_hpara_type() { element_import_stack.pop_back(); } + void move_to_failed(std::unique_ptr<HWPPara> rPara); + private: int compareCharShape(CharShape const *shape); int compareParaShape(ParaShape const *shape); diff --git a/hwpfilter/source/hwpread.cxx b/hwpfilter/source/hwpread.cxx index 5b25025cdf6d..bdb3855f437b 100644 --- a/hwpfilter/source/hwpread.cxx +++ b/hwpfilter/source/hwpread.cxx @@ -491,7 +491,7 @@ bool Picture::Read(HWPFile & hwpf) if (pictype == PICTYPE_DRAW) { auto xGuard(std::make_unique<ChangeMemGuard>(follow.data(), follow_block_size)); - LoadDrawingObjectBlock(this); + LoadDrawingObjectBlock(this, hwpf); style.cell = picinfo.picdraw.hdo; xGuard.reset(); } commit 6882c55c54c9cd5639aa58cb5f4bc1fbba28e82e Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sat Feb 26 19:52:29 2022 +0000 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Thu Aug 11 05:42:41 2022 +0200 ofz#44991 don't skip over terminator Change-Id: Ibc942705a788db60c104d00916a45d595596285e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130560 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 4ac060fce70a4b116207d061efbb6185e6162d04) diff --git a/hwpfilter/source/hcode.cxx b/hwpfilter/source/hcode.cxx index a895caec1eab..4001638e0046 100644 --- a/hwpfilter/source/hcode.cxx +++ b/hwpfilter/source/hcode.cxx @@ -1222,6 +1222,8 @@ hchar_string kstr2hstr(uchar const* src) { ret.push_back(src[i] << 8 | src[i+1]); i++; + if (src[i] == '\0') + break; } } return ret; commit 824f4d461a9b8f2fdf150b0ab18c9ce477b27a89 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sun Feb 27 12:05:38 2022 +0000 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Thu Aug 11 05:41:53 2022 +0200 ofz#45081 check font length Change-Id: Ib8cea70652ae90403db3546c07d24a517b1ec93e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130635 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 568753f4d867c4681b762b63f9b1254f56865da4) diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx index b9839b727f40..d4ff5f413ede 100644 --- a/vcl/source/fontsubset/ttcr.cxx +++ b/vcl/source/fontsubset/ttcr.cxx @@ -1308,14 +1308,21 @@ static void ProcessTables(TrueTypeCreator *tt) do { GlyphData *gd = static_cast<GlyphData *>(listCurrent(glyphlist)); - if (gd->compflag) { /* re-number all components */ + if (gd->compflag && gd->nbytes > 10) { /* re-number all components */ sal_uInt16 flags, index; sal_uInt8 *ptr = gd->ptr + 10; + size_t nRemaining = gd->nbytes - 10; do { - sal_uInt32 j; + if (nRemaining < 4) + { + SAL_WARN("vcl.fonts", "truncated font"); + break; + } flags = GetUInt16(ptr, 0); index = GetUInt16(ptr, 2); + /* XXX use the sorted array of old to new glyphID mapping and do a binary search */ + sal_uInt32 j; for (j = 0; j < nGlyphs; j++) { if (gid[j] == index) { break; @@ -1326,20 +1333,32 @@ static void ProcessTables(TrueTypeCreator *tt) PutUInt16(static_cast<sal_uInt16>(j), ptr, 2); ptr += 4; + nRemaining -= 4; + sal_uInt32 nAdvance = 0; if (flags & ARG_1_AND_2_ARE_WORDS) { - ptr += 4; + nAdvance += 4; } else { - ptr += 2; + nAdvance += 2; } if (flags & WE_HAVE_A_SCALE) { - ptr += 2; + nAdvance += 2; } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) { - ptr += 4; + nAdvance += 4; } else if (flags & WE_HAVE_A_TWO_BY_TWO) { - ptr += 8; + nAdvance += 8; } + + if (nRemaining < nAdvance) + { + SAL_WARN("vcl.fonts", "truncated font"); + break; + } + + ptr += nAdvance; + nRemaining -= nAdvance; + } while (flags & MORE_COMPONENTS); } commit a08bce2c755a08d16e43af5b71c4a08bd2b49848 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Feb 28 09:15:10 2022 +0000 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Thu Aug 11 05:32:35 2022 +0200 ensure null terminator LIBREOFFICE-WB8DT2Q9 Change-Id: I98529325bbd3ff475ba84b4991eb17240440df4b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130668 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Jenkins (cherry picked from commit 4b6956ca146f25b746f63c176b377d3c15d204ff) diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx index ea34c537e970..c7eff5ead338 100644 --- a/sc/source/filter/lotus/op.cxx +++ b/sc/source/filter/lotus/op.cxx @@ -581,14 +581,9 @@ void OP_SheetName123(LotusContext& rContext, SvStream& rStream, sal_uInt16 nLeng sal_uInt16 nSheetNum(0); rStream.ReadUInt16(nSheetNum); - ::std::vector<char> sSheetName; - sSheetName.reserve(nLength-4); - for (sal_uInt16 i = 4; i < nLength; ++i) - { - char c; - rStream.ReadChar( c ); - sSheetName.push_back(c); - } + const size_t nStrLen = nLength - 4; + std::vector<char> sSheetName(nStrLen + 1); + sSheetName[rStream.ReadBytes(sSheetName.data(), nStrLen)] = 0; if (!ValidTab(nSheetNum)) return; commit 3e3d8f0428960a572f847f872edb7fd5aaaf850f Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sat Feb 26 20:04:15 2022 +0000 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Thu Aug 11 05:32:05 2022 +0200 ofz#44991 keep within legal ArrowShape range Change-Id: I6bf70f27a66ba9b355a3f7ae0c68a696a7284871 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130562 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 7171ec3e400505fbeead152718eebd5cc6c624d7) diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index 17cfe7f48ad3..15586354effa 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -459,7 +459,9 @@ void HwpReader::makeDrawMiscStyle( HWPDrawingObject *hdo ) if( hdo->type == HWPDO_LINE || hdo->type == HWPDO_ARC || hdo->type == HWPDO_FREEFORM || hdo->type == HWPDO_ADVANCED_ARC ) { - if( prop->line_tstyle && !ArrowShape[prop->line_tstyle].bMade ) + if( prop->line_tstyle > 0 && + o3tl::make_unsigned(prop->line_tstyle) < std::size(ArrowShape) && + !ArrowShape[prop->line_tstyle].bMade ) { ArrowShape[prop->line_tstyle].bMade = true; padd("draw:name", sXML_CDATA, @@ -483,7 +485,9 @@ void HwpReader::makeDrawMiscStyle( HWPDrawingObject *hdo ) mxList->clear(); rendEl("draw:marker"); } - if( prop->line_hstyle && !ArrowShape[prop->line_hstyle].bMade) + if (prop->line_hstyle > 0 && + o3tl::make_unsigned(prop->line_hstyle) < std::size(ArrowShape) && + !ArrowShape[prop->line_hstyle].bMade) { ArrowShape[prop->line_hstyle].bMade = true; padd("draw:name", sXML_CDATA, @@ -2043,7 +2047,8 @@ void HwpReader::makeDrawStyle( HWPDrawingObject * hdo, FBoxStyle * fstyle) hdo->type == HWPDO_FREEFORM || hdo->type == HWPDO_ADVANCED_ARC ) { - if( hdo->property.line_tstyle > 0 ) + if( hdo->property.line_tstyle > 0 && + o3tl::make_unsigned(hdo->property.line_tstyle) < std::size(ArrowShape) ) { padd("draw:marker-start", sXML_CDATA, ascii(ArrowShape[hdo->property.line_tstyle].name) ); @@ -2064,7 +2069,8 @@ void HwpReader::makeDrawStyle( HWPDrawingObject * hdo, FBoxStyle * fstyle) Double2Str( WTMM(hdo->property.line_width * 7)) + "mm"); } - if( hdo->property.line_hstyle > 0 ) + if( hdo->property.line_hstyle > 0 && + o3tl::make_unsigned(hdo->property.line_hstyle) < std::size(ArrowShape) ) { padd("draw:marker-end", sXML_CDATA, ascii(ArrowShape[hdo->property.line_hstyle].name) ); commit f38d4a2355e96b41b08c0516c59b170000d2d30a Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Feb 22 09:41:26 2022 +0000 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Thu Aug 11 05:31:02 2022 +0200 add to suffix denylist mostly https: //support.google.com/mail/answer/6590?hl=en#zippy=%2Cmessages-that-have-attachments but see also: https://www.howtogeek.com/137270/50-file-extensions-that-are-potentially-dangerous-on-windows Change-Id: Ibe3abbdcdb6f82a73d245318ef97d86789d00523 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130394 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130382 Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> (cherry picked from commit 8b72ddb734e0f4457d0233ae9e56dd76526f1dc9) diff --git a/shell/source/win32/SysShExec.cxx b/shell/source/win32/SysShExec.cxx index 0069a849744e..7de64f54229c 100644 --- a/shell/source/win32/SysShExec.cxx +++ b/shell/source/win32/SysShExec.cxx @@ -341,8 +341,12 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa if (!(checkExtension(ext, env) && checkExtension( ext, - ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.MSI;.PY;.CLASS;" - ".JAR;.APPLICATION;.LNK;.SCR"))) + ".ADE;.ADP;.APK;.APPLICATION;.APPX;.APPXBUNDLE;.BAT;.CAB;.CHM;.CLASS;" + ".CMD;.COM;.CPL;.DLL;.DMG;.EX;.EX_;.EXE;.GADGET;.HTA;.INF;.INS;.IPA;" + ".ISO;.ISP;.JAR;.JS;.JSE;.LIB;.LNK;.MDE;.MSC;.MSH;.MSH1;.MSH2;.MSHXML;" + ".MSH1XML;.MSH2XML;.MSI;.MSIX;.MSIXBUNDLE;.MSP;.MST;.NSH;.PIF;.PS1;" + ".PS1XML;.PS2;.PS2XML;.PSC1;.PSC2;.PY;.REG;.SCF;.SCR;.SCT;.SHB;.SYS;" + ".VB;.VBE;.VBS;.VXD;.WS;.WSC;.WSF;.WSH;"))) { throw css::lang::IllegalArgumentException( "XSystemShellExecute.execute, cannot process <" + aCommand + ">", {}, commit d2d8b4d9f54c0edcd599c912782d38ddb91b6262 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Feb 22 16:09:53 2022 +0000 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Thu Aug 11 05:31:02 2022 +0200 keep paragraph's that failed to load until import is complete LIBREOFFICE-509JU93T Change-Id: I526edb182fed4fa023cce58e78a650a7c2046ed3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130326 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 32e8d3e45698a3cc09f66460b460db1d10ac50b5) diff --git a/hwpfilter/source/hwpfile.cxx b/hwpfilter/source/hwpfile.cxx index 8be445919ed4..13ce581b2266 100644 --- a/hwpfilter/source/hwpfile.cxx +++ b/hwpfilter/source/hwpfile.cxx @@ -244,6 +244,7 @@ void HWPFile::ReadParaList(std::vector < HWPPara* > &aplist) aplist.push_back(spNode.release()); spNode.reset( new HWPPara ); } + pfailedlist.push_back(std::move(spNode)); } void HWPFile::ReadParaList(std::vector< std::unique_ptr<HWPPara> > &aplist, unsigned char flag) @@ -277,6 +278,7 @@ void HWPFile::ReadParaList(std::vector< std::unique_ptr<HWPPara> > &aplist, unsi aplist.push_back(std::move(spNode)); spNode.reset( new HWPPara ); } + pfailedlist.push_back(std::move(spNode)); } void HWPFile::TagsRead() diff --git a/hwpfilter/source/hwpfile.h b/hwpfilter/source/hwpfile.h index 9cc3b72a7c65..f5f30d925416 100644 --- a/hwpfilter/source/hwpfile.h +++ b/hwpfilter/source/hwpfile.h @@ -283,6 +283,10 @@ class DLLEXPORT HWPFile std::vector<std::unique_ptr<ColumnInfo>> columnlist; // paragraph list std::vector<std::unique_ptr<HWPPara>> plist; + // keep paragraph's that failed to load until + // import is complete to avoid dangling references + // elsewhere + std::vector<std::unique_ptr<HWPPara>> pfailedlist; // floating box list std::vector<FBox*> blist; // embedded picture list(tag data) commit 66d51eb128bf949be889b81c75f224d5ca043f96 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Thu Feb 17 15:27:59 2022 +0100 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Thu Aug 11 05:31:01 2022 +0200 fix range checking in calls like ScDocument::GetNote() Change-Id: I5612e765b3484b0515f4a16030ee19133ae3126a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130076 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> (cherry picked from commit 957d99a539df6e21fd40370938ca5dab1613cf8c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130105 Reviewed-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit 77bef67094579e7d0d2a515f5f8a5def8abe49e8) diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 09e71f139466..cc5cd8af46b8 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -467,6 +467,8 @@ public: void GetLastDataPos(SCCOL& rCol, SCROW& rRow) const; std::unique_ptr<ScPostIt> ReleaseNote( SCCOL nCol, SCROW nRow ); + ScPostIt* GetNote( SCCOL nCol, SCROW nRow ); + void SetNote( SCCOL nCol, SCROW nRow, std::unique_ptr<ScPostIt> pNote ); size_t GetNoteCount( SCCOL nCol ) const; SCROW GetNotePosition( SCCOL nCol, size_t nIndex ) const; diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 77c61d626a4b..15ec4ab363dd 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -6499,9 +6499,8 @@ ScPostIt* ScDocument::GetNote(const ScAddress& rPos) ScPostIt* ScDocument::GetNote(SCCOL nCol, SCROW nRow, SCTAB nTab) { - if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && - nCol < maTabs[nTab]->GetAllocatedColumnsCount()) - return maTabs[nTab]->aCol[nCol].GetCellNote(nRow); + if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size())) + return maTabs[nTab]->GetNote(nCol, nRow); else return nullptr; @@ -6514,7 +6513,8 @@ void ScDocument::SetNote(const ScAddress& rPos, std::unique_ptr<ScPostIt> pNote) void ScDocument::SetNote(SCCOL nCol, SCROW nRow, SCTAB nTab, std::unique_ptr<ScPostIt> pNote) { - return maTabs[nTab]->CreateColumnIfNotExists(nCol).SetCellNote(nRow, std::move(pNote)); + if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size())) + maTabs[nTab]->SetNote(nCol, nRow, std::move(pNote)); } bool ScDocument::HasNote(const ScAddress& rPos) const @@ -6547,6 +6547,9 @@ bool ScDocument::HasColNotes(SCCOL nCol, SCTAB nTab) const if (!pTab) return false; + if (nCol >= pTab->GetAllocatedColumnsCount()) + return false; + return pTab->aCol[nCol].HasCellNotes(); } @@ -6590,6 +6593,7 @@ ScPostIt* ScDocument::GetOrCreateNote(const ScAddress& rPos) else return CreateNote(rPos); } + ScPostIt* ScDocument::CreateNote(const ScAddress& rPos) { ScPostIt* pPostIt = new ScPostIt(*this, rPos); diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 7dca833d8277..94ddec561a23 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -1676,6 +1676,21 @@ std::unique_ptr<ScPostIt> ScTable::ReleaseNote( SCCOL nCol, SCROW nRow ) return aCol[nCol].ReleaseNote(nRow); } +ScPostIt* ScTable::GetNote( SCCOL nCol, SCROW nRow ) +{ + if (!ValidCol(nCol) || nCol >= GetAllocatedColumnsCount()) + return nullptr; + return aCol[nCol].GetCellNote(nRow); +} + +void ScTable::SetNote( SCCOL nCol, SCROW nRow, std::unique_ptr<ScPostIt> pNote ) +{ + if (!ValidColRow(nCol, nRow)) + return; + + CreateColumnIfNotExists(nCol).SetCellNote(nRow, std::move(pNote)); +} + size_t ScTable::GetNoteCount( SCCOL nCol ) const { if (!ValidCol(nCol) || nCol >= GetAllocatedColumnsCount()) commit e40db862726604ec51078044130a65bb185859a4 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Feb 16 11:14:48 2022 +0000 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Thu Aug 11 05:31:01 2022 +0200 clear ScDocumentImport position cache if iterators are invalid SheetDataBuffer::finalizeArrayFormula calls ScCellRangeObj::setArrayTokens ScDocFunc::EnterMatrix ScDocument::InsertMatrixFormula and InsertMatrixFormula calls the variant of ScColumn::SetFormulaCell which doesn't take a sc::ColumnBlockPosition& param when SetFormulaCell adds a cell to the column so any iterators belonging to ScDocumentImport are invalid. Change-Id: Ic2814ecbeafdeb99632d2a255ed6c1dedf7376b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130151 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> (cherry picked from commit fea55f5ef8dba16706033c9efdd33c45477eb333) diff --git a/sc/inc/documentimport.hxx b/sc/inc/documentimport.hxx index 758469f258a6..ed77561a5153 100644 --- a/sc/inc/documentimport.hxx +++ b/sc/inc/documentimport.hxx @@ -125,6 +125,8 @@ public: void setMergedCells(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); + void invalidateBlockPositionSet(SCTAB nTab); + void finalize(); /** Broadcast all formula cells that are marked with diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx index f4cb0e24c0c0..f2984dbb859a 100644 --- a/sc/source/core/data/documentimport.cxx +++ b/sc/source/core/data/documentimport.cxx @@ -93,6 +93,15 @@ struct ScDocumentImportImpl return rTab.getBlockPosition(nCol); } + void invalidateBlockPositionSet(SCTAB nTab) + { + if (o3tl::make_unsigned(nTab) >= maBlockPosSet.size()) + return; + + sc::TableColumnBlockPositionSet& rTab = maBlockPosSet[nTab]; + rTab.invalidate(); + } + void initForSheets() { size_t n = mrDoc.GetTableCount(); @@ -180,6 +189,11 @@ void ScDocumentImport::setOriginDate(sal_uInt16 nYear, sal_uInt16 nMonth, sal_uI mpImpl->mrDoc.pDocOptions->SetDate(nDay, nMonth, nYear); } +void ScDocumentImport::invalidateBlockPositionSet(SCTAB nTab) +{ + mpImpl->invalidateBlockPositionSet(nTab); +} + void ScDocumentImport::setAutoInput(const ScAddress& rPos, const OUString& rStr, const ScSetStringParam* pStringParam) { ScTable* pTab = mpImpl->mrDoc.FetchTable(rPos.Tab()); diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx index de1d2c76f3c9..314d21fbe711 100644 --- a/sc/source/filter/oox/sheetdatabuffer.cxx +++ b/sc/source/filter/oox/sheetdatabuffer.cxx @@ -403,9 +403,22 @@ void SheetDataBuffer::addColXfStyle( sal_Int32 nXfId, sal_Int32 nFormatId, const void SheetDataBuffer::finalizeImport() { + ScDocumentImport& rDocImport = getDocImport(); + + SCTAB nStartTabInvalidatedIters(SCTAB_MAX); + SCTAB nEndTabInvalidatedIters(0); + // create all array formulas for( const auto& [rRange, rTokens] : maArrayFormulas ) - finalizeArrayFormula( rRange, rTokens ); + { + finalizeArrayFormula(rRange, rTokens); + + nStartTabInvalidatedIters = std::min(rRange.aStart.Tab(), nStartTabInvalidatedIters); + nEndTabInvalidatedIters = std::max(rRange.aEnd.Tab(), nEndTabInvalidatedIters); + } + + for (SCTAB nTab = nStartTabInvalidatedIters; nTab <= nEndTabInvalidatedIters; ++nTab) + rDocImport.invalidateBlockPositionSet(nTab); // create all table operations for( const auto& [rRange, rModel] : maTableOperations ) @@ -441,7 +454,6 @@ void SheetDataBuffer::finalizeImport() } } - ScDocumentImport& rDocImport = getDocImport(); ScDocument& rDoc = rDocImport.getDoc(); StylesBuffer& rStyles = getStyles(); for ( const auto& [rCol, rRowStyles] : maStylesPerColumn ) commit 3a8fe3a415e7aa7bbb9688c4f28d1bd816a4f42a Author: Renwa Hiwa <renwa...@gmail.com> AuthorDate: Tue Feb 22 09:36:29 2022 +0000 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Thu Aug 11 05:31:01 2022 +0200 Better handling of msi LIBREOFFICE-SK4E5D8N Change-Id: I44f25a47ab6ffeb9d2b679874c8c96af1319eb2c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130317 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit ccaabe8e8100a3a0600456c5a65221ca2b263c95) diff --git a/shell/source/win32/SysShExec.cxx b/shell/source/win32/SysShExec.cxx index fde14e268c26..0069a849744e 100644 --- a/shell/source/win32/SysShExec.cxx +++ b/shell/source/win32/SysShExec.cxx @@ -341,7 +341,7 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa if (!(checkExtension(ext, env) && checkExtension( ext, - ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.CLASS;" + ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.MSI;.PY;.CLASS;" ".JAR;.APPLICATION;.LNK;.SCR"))) { throw css::lang::IllegalArgumentException( commit 64bebaacbe9387496cc10d7a6096ee33da2cf68f Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Jan 28 15:02:54 2022 +0000 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Thu Aug 11 05:30:51 2022 +0200 avoid dangling tmp files in hwp import if there is embedded data use office-binary-data to transport it instead of a temp file https: //issues.oasis-open.org/browse/OFFICE-3933 Change-Id: Ia1cebf0770c99210df09f03dbb507451d9cf7764 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129076 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit e95d5d5666505cb05e9660f24f6c7ae039451ef8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129759 (cherry picked from commit bfff5c7dadf9628926fbb5cd0394fcfc4464eb0b) diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index 4cfa65356c4b..17cfe7f48ad3 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -514,62 +514,28 @@ void HwpReader::makeDrawMiscStyle( HWPDrawingObject *hdo ) if( prop->flag >> 18 & 0x01 ) { padd( "draw:name", sXML_CDATA, ascii(Int2Str(hdo->index, "fillimage%d", buf))); - if( !prop->pictype ) + + EmPicture *emp = nullptr; + if (prop->pictype && strlen(prop->szPatternFile) > 3) + emp = hwpfile.GetEmPictureByName(prop->szPatternFile); + if (!emp) { padd( "xlink:href", sXML_CDATA, fromHcharStringToOUString(hstr2ucsstr(kstr2hstr( reinterpret_cast<uchar const *>(urltounix(prop->szPatternFile).c_str())).c_str()))); + padd( "xlink:type", sXML_CDATA, "simple"); + padd( "xlink:show", sXML_CDATA, "embed"); + padd( "xlink:actuate", sXML_CDATA, "onLoad"); } - else - { - EmPicture *emp = nullptr; - if ( strlen( prop->szPatternFile ) > 3) - emp = hwpfile.GetEmPictureByName(prop->szPatternFile); - if( emp ) - { - char filename[128+17+9]; - char dirname[128]; - int fd; -#ifdef _WIN32 - GetTempPathA(sizeof(dirname), dirname); - sprintf(filename, "%s%s",dirname, emp->name); - if( (fd = open( filename , _O_CREAT | _O_WRONLY | _O_BINARY , 0666)) >= 0 ) -#else - strcpy(dirname, "/tmp/"); - sprintf(filename, "%s%s", dirname, emp->name); - if( (fd = open( filename , O_CREAT | O_WRONLY , 0666)) >= 0 ) -#endif - { - size_t nWritten = write(fd, emp->data.get(), emp->size); - OSL_VERIFY(nWritten == emp->size); - close(fd); - } -#ifdef _WIN32 - int j; - for(j = 0 ; j < static_cast<int>(strlen( dirname )) ; j++) - { - if( dirname[j] == '\\' ) buf[j] = '/'; - else buf[j] = dirname[j]; - } - buf[j] = '\0'; - sprintf(filename, "file:///%s%s",buf, emp->name ); -#else - sprintf(filename, "file://%s%s",dirname, emp->name ); -#endif - padd( "xlink:href", sXML_CDATA, ascii(filename)); - } - else - { - padd( "xlink:href", sXML_CDATA, - fromHcharStringToOUString(hstr2ucsstr(kstr2hstr( reinterpret_cast<uchar const *>(urltounix(prop->szPatternFile).c_str())).c_str()))); - } - - } - padd( "xlink:type", sXML_CDATA, "simple"); - padd( "xlink:show", sXML_CDATA, "embed"); - padd( "xlink:actuate", sXML_CDATA, "onLoad"); rstartEl( "draw:fill-image", mxList.get()); mxList->clear(); + if (emp) + { + rstartEl("office:binary-data", mxList.get()); + std::shared_ptr<char> pStr(base64_encode_string(emp->data.get(), emp->size), Free<char>()); + rchars(ascii(pStr.get())); + rendEl("office:binary-data"); + } rendEl( "draw:fill-image"); } /* If there is a gradient, when a bitmap file is present, this is the first. */ commit 5bb7f02cee0382d7c45955bfbdcee73d486c9135 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Jan 28 11:34:23 2022 +0000 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Wed Aug 10 23:17:38 2022 +0200 use our own tempfile mechanism Change-Id: Ie7853ea8bd083d1056872cfad4323ff6cede235f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129071 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 45c15e1112e03b8b211ed0968ed1b16d5ed4ddfe) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129758 (cherry picked from commit 63fcec3105b060cffde5e94fe688c8a59418e4c0) diff --git a/hwpfilter/source/htags.cxx b/hwpfilter/source/htags.cxx index d0a7d772ce15..7ff67b8b2016 100644 --- a/hwpfilter/source/htags.cxx +++ b/hwpfilter/source/htags.cxx @@ -19,6 +19,9 @@ #include "precompile.h" +#include <o3tl/char16_t2wchar_t.hxx> +#include <unotools/tempfile.hxx> + #include <string.h> #include "hwplib.h" @@ -106,27 +109,20 @@ void OlePicture::Read(HWPFile & hwpf) delete [] data; return; } - FILE *fp; - char tname[200]; - wchar_t wtname[200]; - tmpnam(tname); - if (nullptr == (fp = fopen(tname, "wb"))) - { - delete [] data; - return; - } - fwrite(data, size, 1, fp); + + utl::TempFile aTempFile; + aTempFile.EnableKillingFile(); + + SvFileStream aOutputStream(aTempFile.GetURL(), StreamMode::WRITE); + aOutputStream.WriteBytes(data, size); delete [] data; - fclose(fp); - MultiByteToWideChar(CP_ACP, 0, tname, -1, wtname, 200); - if( StgOpenStorage(wtname, nullptr, + aOutputStream.Close(); + if( StgOpenStorage(o3tl::toW(aTempFile.GetFileName().getStr()), nullptr, STGM_READWRITE|STGM_SHARE_EXCLUSIVE|STGM_TRANSACTED, nullptr, 0, &pis) != S_OK ) { pis = nullptr; - unlink(tname); return; } - unlink(tname); #else hwpf.SkipBlock(size); #endif commit bdf516ff4c77db4cf5f124aef3dd6edb642886aa Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Feb 10 10:53:27 2022 +0000 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Wed Aug 10 23:16:57 2022 +0200 limit style export to words max style count and use std::vector LIBREOFFICE-U78X8I5G Change-Id: I436b4c13a4ce07f5e9e5d374163bc4de55cd2cde Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129766 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 8e94ec9d93fe3e1057fb1aaa2f0419114c4ea11c) diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 282bd90efab9..1a6a9ec7e400 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -151,13 +151,13 @@ MSWordStyles::MSWordStyles( MSWordExportBase& rExport, bool bListStyles ) m_rExport.m_rDoc.GetFootnoteInfo().GetAnchorCharFormat( m_rExport.m_rDoc ); m_rExport.m_rDoc.GetFootnoteInfo().GetCharFormat( m_rExport.m_rDoc ); } - sal_uInt16 nAlloc = WW8_RESERVED_SLOTS + m_rExport.m_rDoc.GetCharFormats()->size() - 1 + + sal_uInt32 nAlloc = WW8_RESERVED_SLOTS + m_rExport.m_rDoc.GetCharFormats()->size() - 1 + m_rExport.m_rDoc.GetTextFormatColls()->size() - 1 + (bListStyles ? m_rExport.m_rDoc.GetNumRuleTable().size() - 1 : 0); + nAlloc = std::min<sal_uInt32>(nAlloc, MSWORD_MAX_STYLES_LIMIT); // somewhat generous ( free for up to 15 ) - m_pFormatA.reset( new SwFormat*[ nAlloc ] ); - memset( m_pFormatA.get(), 0, nAlloc * sizeof( SwFormat* ) ); + m_aFormatA.resize(nAlloc, nullptr); memset( m_aHeadingParagraphStyles, -1 , MAXLEVEL * sizeof( sal_uInt16)); BuildStylesTable(); @@ -173,7 +173,7 @@ sal_uInt16 MSWordStyles::GetSlot( const SwFormat* pFormat ) const { sal_uInt16 n; for ( n = 0; n < m_nUsedSlots; n++ ) - if ( m_pFormatA[n] == pFormat ) + if ( m_aFormatA[n] == pFormat ) return n; return 0xfff; // 0xfff: WW: zero } @@ -283,19 +283,19 @@ void MSWordStyles::BuildStylesTable() const SwCharFormats& rArr = *m_rExport.m_rDoc.GetCharFormats(); // first CharFormat // the default character style ( 0 ) will not be outputted ! - for( size_t n = 1; n < rArr.size(); n++ ) + for( size_t n = 1; n < rArr.size() && m_nUsedSlots < MSWORD_MAX_STYLES_LIMIT; n++ ) { SwCharFormat* pFormat = rArr[n]; - m_pFormatA[ BuildGetSlot( *pFormat ) ] = pFormat; + m_aFormatA[ BuildGetSlot( *pFormat ) ] = pFormat; } const SwTextFormatColls& rArr2 = *m_rExport.m_rDoc.GetTextFormatColls(); // then TextFormatColls // the default character style ( 0 ) will not be outputted ! - for( size_t n = 1; n < rArr2.size(); n++ ) + for( size_t n = 1; n < rArr2.size() && m_nUsedSlots < MSWORD_MAX_STYLES_LIMIT; n++ ) { SwTextFormatColl* pFormat = rArr2[n]; sal_uInt16 nId = BuildGetSlot( *pFormat ) ; - m_pFormatA[ nId ] = pFormat; + m_aFormatA[ nId ] = pFormat; if ( pFormat->IsAssignedToListLevelOfOutlineStyle() ) { int nLvl = pFormat->GetAssignedOutlineStyleLevel() ; @@ -308,7 +308,7 @@ void MSWordStyles::BuildStylesTable() return; const SwNumRuleTable& rNumRuleTable = m_rExport.m_rDoc.GetNumRuleTable(); - for (size_t i = 0; i < rNumRuleTable.size(); ++i) + for (size_t i = 0; i < rNumRuleTable.size() && m_nUsedSlots < MSWORD_MAX_STYLES_LIMIT; ++i) { const SwNumRule* pNumRule = rNumRuleTable[i]; if (pNumRule->IsAutoRule() || pNumRule->GetName().startsWith("WWNum")) @@ -348,8 +348,8 @@ void MSWordStyles::BuildStyleIds() for (sal_uInt16 n = 1; n < m_nUsedSlots; ++n) { OUString aName; - if(m_pFormatA[n]) - aName = m_pFormatA[n]->GetName(); + if (m_aFormatA[n]) + aName = m_aFormatA[n]->GetName(); else if (m_aNumRules.find(n) != m_aNumRules.end()) aName = m_aNumRules[n]->GetName(); @@ -613,8 +613,8 @@ void MSWordStyles::OutputStyle( SwFormat* pFormat, sal_uInt16 nPos ) for ( int nSuffix = 0; ; ++nSuffix ) { bool clash=false; for ( sal_uInt16 n = 1; n < m_nUsedSlots; ++n ) - if ( m_pFormatA[n] && - m_pFormatA[n]->GetName().equalsIgnoreAsciiCase(aName) ) + if ( m_aFormatA[n] && + m_aFormatA[n]->GetName().equalsIgnoreAsciiCase(aName) ) { clash = true; break; @@ -703,7 +703,7 @@ void MSWordStyles::OutputStylesTable() if (m_aNumRules.find(n) != m_aNumRules.end()) OutputStyle(m_aNumRules[n], n); else - OutputStyle( m_pFormatA[n], n ); + OutputStyle(m_aFormatA[n], n); } m_rExport.AttrOutput().EndStyles( m_nUsedSlots ); diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 69f9f2b1a2ed..b6cafe60d392 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -1565,7 +1565,7 @@ class MSWordStyles { MSWordExportBase& m_rExport; sal_uInt16 m_aHeadingParagraphStyles[MAXLEVEL]; - std::unique_ptr<SwFormat*[]> m_pFormatA; ///< Slot <-> Character and paragraph style array (0 for list styles). + std::vector<SwFormat*> m_aFormatA; ///< Slot <-> Character and paragraph style array (0 for list styles). sal_uInt16 m_nUsedSlots; bool m_bListStyles; ///< If list styles are requested to be exported as well. std::map<sal_uInt16, const SwNumRule*> m_aNumRules; ///< Slot <-> List style map. @@ -1616,7 +1616,7 @@ public: /// Get styleId of the nId-th style (nId is its position in pFormatA). OString const & GetStyleId(sal_uInt16 nId) const; - const SwFormat* GetSwFormat(sal_uInt16 nId) const { return m_pFormatA[nId]; } + const SwFormat* GetSwFormat(sal_uInt16 nId) const { return m_aFormatA[nId]; } /// Get numbering rule of the nId-th style const SwNumRule* GetSwNumRule(sal_uInt16 nId) const; sal_uInt16 GetHeadingParagraphStyleId(sal_uInt16 nLevel) const { return m_aHeadingParagraphStyles[ nLevel ]; } commit 04427af8479c33025a52abe99e05334e573b6158 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Nov 24 20:27:48 2021 +0000 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Wed Aug 10 23:07:31 2022 +0200 tdf#145842 canceling remote file delete makes file disappear from treeview we remove the selected entries from the treeview, so the user cancel's the deletion of an entry we should unselect it from the candidates to remove. and... Related: tdf#145842 fix a crash after deleting an entry delete an entry in remote files dialog and go one level up and crash, ownership of the SvtContentEntry is not with the entry, but belongs to mpImpl->maEntries Change-Id: Ieb2258960fc647ad15d8f315a18454a0dae8a420 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125793 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Jenkins (cherry picked from commit 9d13202243b26d507b61eb4a787d1df2ce037e21) diff --git a/fpicker/source/office/fileview.cxx b/fpicker/source/office/fileview.cxx index ad82be6c0463..6690c64a7cef 100644 --- a/fpicker/source/office/fileview.cxx +++ b/fpicker/source/office/fileview.cxx @@ -642,16 +642,20 @@ void ViewTabListBox_Impl::DeleteEntries() eResult = aDlg.run(); } - if ( ( eResult == svtools::QUERYDELETE_ALL ) || - ( eResult == svtools::QUERYDELETE_YES ) ) + bool bDeleted = false; + + if (eResult == svtools::QUERYDELETE_ALL || eResult == svtools::QUERYDELETE_YES) { if ( Kill( aURL ) ) { - delete reinterpret_cast<SvtContentEntry*>(mxTreeView->get_id(rCurEntry).toInt64()); mpParent->EntryRemoved( aURL ); + bDeleted = true; } } + if (!bDeleted) + mxTreeView->unselect(rCurEntry); + return false; }); commit 6f547d3a6c32ffbafd495752f8e71cdc52ac9e7b Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Nov 24 17:07:29 2021 +0000 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Wed Aug 10 23:06:43 2022 +0200 Resolves: tdf#145840 call ToggledDavsHdl on setting checkbox state Change-Id: Ia2a735255b94fd3a097081950e2145e07b4b3b63 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125723 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit b23a16ff513369b6bf1f534a387d911b6336c9c8) diff --git a/svtools/source/dialogs/ServerDetailsControls.cxx b/svtools/source/dialogs/ServerDetailsControls.cxx index 339704dc6fc2..d8b0ba0a2fc3 100644 --- a/svtools/source/dialogs/ServerDetailsControls.cxx +++ b/svtools/source/dialogs/ServerDetailsControls.cxx @@ -176,11 +176,13 @@ bool DavDetailsContainer::verifyScheme( const OUString& rScheme ) { bValid = true; m_pDialog->m_xCBDavs->set_active(false); + ToggledDavsHdl(*m_pDialog->m_xCBDavs); } else if ( rScheme == "https://" ) { bValid = true; m_pDialog->m_xCBDavs->set_active(true); + ToggledDavsHdl(*m_pDialog->m_xCBDavs); } return bValid; } commit 859bdd4817e50d3d7ca217e03628bfb7db9076f5 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Fri Mar 11 17:29:41 2022 +0100 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Wed Aug 10 23:05:44 2022 +0200 hwpfilter: why isn't that path string null terminated Change-Id: Iaedc23bd91d0d46e34d55dcc65760b73c5772b7e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131559 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 4c86ed851bc1c0a2414e254082064760c99437f1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131593 Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> (cherry picked from commit eb84cf3f406808658f3efd9320e0a047c90be12f) diff --git a/hwpfilter/source/hwpread.cxx b/hwpfilter/source/hwpread.cxx index 36fb77996c56..5b25025cdf6d 100644 --- a/hwpfilter/source/hwpread.cxx +++ b/hwpfilter/source/hwpread.cxx @@ -451,6 +451,7 @@ bool Picture::Read(HWPFile & hwpf) scale[1] = tmp16; hwpf.ReadBlock(picinfo.picun.path, 256); /* Picture File Name: when type is not a Drawing. */ + picinfo.picun.path[255] = 0; // ensure null terminated hwpf.ReadBlock(reserved3, 9); /* Brightness / Contrast / Picture Effect, etc. */ UpdateBBox(this); commit 6704ee9191bd1c637f587dff9998ad88395d9dd1 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sun Mar 6 15:49:28 2022 +0000 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Wed Aug 10 23:01:48 2022 +0200 ofz: Too many hatch points Change-Id: I08cb9d09a9bb48ab31763f50bc2fa23cf723330f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131014 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit bee0950a4c5bd996a8df0185b03c0f98e7a3de9c) diff --git a/vcl/source/outdev/hatch.cxx b/vcl/source/outdev/hatch.cxx index 374282c374df..1ffc3bcc0d3f 100644 --- a/vcl/source/outdev/hatch.cxx +++ b/vcl/source/outdev/hatch.cxx @@ -373,7 +373,14 @@ void OutputDevice::DrawHatchLine( const tools::Line& rLine, const tools::PolyPol nAdd = 1; if( nAdd ) + { + if (nPCounter == HATCH_MAXPOINTS) + { + SAL_WARN("vcl.gdi", "too many hatch points"); + return; + } pPtBuffer[ nPCounter++ ] = Point( FRound( fX ), FRound( fY ) ); + } } aCurSegment.SetStart( aCurSegment.GetEnd() );