connectivity/source/drivers/dbase/DDatabaseMetaData.cxx | 2 - connectivity/source/drivers/postgresql/pq_databasemetadata.cxx | 4 +- framework/source/services/pathsettings.cxx | 2 - framework/source/uielement/menubarmerger.cxx | 2 - sc/source/core/tool/interpr1.cxx | 2 - sc/source/ui/unoobj/dapiuno.cxx | 2 - sd/source/ui/func/funavig.cxx | 2 - sfx2/source/doc/docfile.cxx | 14 +++++-- slideshow/source/engine/animationnodes/animationbasenode.cxx | 8 ++-- slideshow/source/engine/animationnodes/animationsetnode.cxx | 6 +-- svx/source/gallery2/galleryfilestorage.cxx | 3 - svx/source/sidebar/nbdtmg.cxx | 2 - sw/source/ui/dbui/createaddresslistdialog.cxx | 2 - sw/source/uibase/docvw/HeaderFooterWin.cxx | 4 +- sw/source/uibase/shells/annotsh.cxx | 3 + sw/source/uibase/shells/drwtxtex.cxx | 3 + sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx | 2 - vcl/source/bitmap/dibtools.cxx | 18 +++++++--- 18 files changed, 48 insertions(+), 33 deletions(-)
New commits: commit 44ffdd91804336ba5bcdbad6a1bcc1747c86d504 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Tue Aug 12 09:47:33 2025 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Tue Aug 12 15:38:15 2025 +0200 cid#1660359 Overflowed constant Change-Id: I8bfa4d1280f5173d811314ff6354e57db3d2fcba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189410 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/vcl/source/bitmap/dibtools.cxx b/vcl/source/bitmap/dibtools.cxx index 8e8093473fa6..0eb415627299 100644 --- a/vcl/source/bitmap/dibtools.cxx +++ b/vcl/source/bitmap/dibtools.cxx @@ -1061,15 +1061,25 @@ bool ImplReadDIBFileHeader( SvStream& rIStm, sal_uLong& rOffset ) rIStm.ReadUInt16( nTmp16 ); rIStm.SeekRel( 8 ); rIStm.ReadUInt32( nTmp32 ); - rOffset = nTmp32 - 28; - bRet = ( 0x4D42 == nTmp16 ); + if (nTmp32 < 28) + rIStm.SetError(SVSTREAM_FILEFORMAT_ERROR); + else + { + rOffset = nTmp32 - 28; + bRet = ( 0x4D42 == nTmp16 ); + } } else // 0x4D42 == nTmp16, 'MB' from BITMAPFILEHEADER { rIStm.SeekRel( 8 ); // we are on bfSize member of BITMAPFILEHEADER, forward to bfOffBits rIStm.ReadUInt32( nTmp32 ); // read bfOffBits - rOffset = nTmp32 - 14; // adapt offset by sizeof(BITMAPFILEHEADER) - bRet = rIStm.GetError() == ERRCODE_NONE; + if (nTmp32 < 14) + rIStm.SetError(SVSTREAM_FILEFORMAT_ERROR); + else + { + rOffset = nTmp32 - 14; // adapt offset by sizeof(BITMAPFILEHEADER) + bRet = rIStm.GetError() == ERRCODE_NONE; + } } if ( rOffset >= nStreamLength ) commit 16bd75a56c16cce6d07284d041f225a81550eb48 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Tue Aug 12 09:03:26 2025 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Tue Aug 12 15:37:59 2025 +0200 cid#1659785 Variable copied when it could be moved and cid#1659793 Variable copied when it could be moved cid#1659830 Variable copied when it could be moved cid#1659841 Variable copied when it could be moved cid#1659856 Variable copied when it could be moved cid#1659863 Variable copied when it could be moved cid#1659864 Variable copied when it could be moved cid#1659865 Variable copied when it could be moved cid#1659903 Variable copied when it could be moved cid#1659909 Variable copied when it could be moved cid#1659917 Variable copied when it could be moved cid#1659924 Variable copied when it could be moved cid#1659929 Variable copied when it could be moved cid#1659930 Variable copied when it could be moved cid#1659932 Variable copied when it could be moved cid#1660056 Variable copied when it could be moved cid#1660112 Variable copied when it could be moved cid#1660169 Variable copied when it could be moved Change-Id: I623009beb8e4a61b2253a17f356576bd3ac3f06c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189402 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx index 7e17e1fc0d79..f34d90fdcaa5 100644 --- a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx +++ b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx @@ -140,7 +140,7 @@ Reference< XResultSet > ODbaseDatabaseMetaData::impl_getTypeInfo_throw( ) aRow[3] = new ORowSetValueDecorator(sal_Int32(16)); aRow[13] = new ORowSetValueDecorator(u"N"_ustr); aRow[15] = new ORowSetValueDecorator(sal_Int32(16)); - aRows.push_back(aRow); + aRows.push_back(std::move(aRow)); pResult->setRows(std::move(aRows)); return pResult; diff --git a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx index 24a3b5a92cb4..26d42eae819c 100644 --- a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx +++ b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx @@ -1591,7 +1591,7 @@ css::uno::Reference< XResultSet > DatabaseMetaData::getColumns( row[15] <<= precision; row[16] <<= colNum ; - vec.push_back( row ); + vec.push_back(std::move(row)); } } Reference< XCloseable > closeable( statement, UNO_QUERY ); @@ -2252,7 +2252,7 @@ namespace row[MINIMUM_SCALE] <<= u"0"_ustr; // TODO: what is this ? row[MAXIMUM_SCALE] <<= OUString::number( getMaxScale( dataType ) ); row[NUM_PREC_RADIX] <<= u"10"_ustr; // TODO: what is this ? - vec.push_back( row ); + vec.push_back(std::move(row)); } } } diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx index 9eef666ac247..13727cb0dcb7 100644 --- a/framework/source/services/pathsettings.cxx +++ b/framework/source/services/pathsettings.cxx @@ -775,7 +775,7 @@ PathSettings::EChangeOp PathSettings::impl_updatePath(std::unique_lock<std::mute pPathNew = &aPath; impl_notifyPropListener(g, sPath, pPathOld, pPathNew); } - m_lPaths[sPath] = aPath; + m_lPaths[sPath] = std::move(aPath); } break; diff --git a/framework/source/uielement/menubarmerger.cxx b/framework/source/uielement/menubarmerger.cxx index dfdebdc7919a..c908e267374b 100644 --- a/framework/source/uielement/menubarmerger.cxx +++ b/framework/source/uielement/menubarmerger.cxx @@ -421,7 +421,7 @@ void MenuBarMerger::GetSubMenu( AddonMenuItem aMenuItem; GetMenuEntry( rMenuEntry, aMenuItem ); - rSubMenu.push_back( aMenuItem ); + rSubMenu.push_back(std::move(aMenuItem)); } } diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index b3db5ea16bd8..f205ccfc4864 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -9659,7 +9659,7 @@ void ScInterpreter::ScTextSplit() { std::vector<OUString> aColStrs = lcl_SplitText(rRow, aColDelimiters, bIgnoreEmpty, bMatchMode); nCols = std::max(nCols, aColStrs.size()); - aRes.push_back(aColStrs); + aRes.push_back(std::move(aColStrs)); } ScMatrixRef pResMat = GetNewMat(nCols, nRows, /*bEmpty*/true); diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index 7baf38707020..ed95a593bd54 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -2268,7 +2268,7 @@ DataPilotFieldGroupInfo ScDataPilotFieldObj::getGroupInfo() for( sal_Int32 nMemIdx = 0, nMemCount = rGroup.GetElementCount(); nMemIdx < nMemCount; ++nMemIdx ) if (const OUString* pMem = rGroup.GetElementByIndex(nMemIdx)) aGroup.maMembers.push_back( *pMem ); - aGroups.push_back( aGroup ); + aGroups.push_back(std::move(aGroup)); } aInfo.Groups = new ScDataPilotFieldGroupsObj( std::move(aGroups) ); } diff --git a/sd/source/ui/func/funavig.cxx b/sd/source/ui/func/funavig.cxx index ee2c530b9374..9d085536eb8d 100644 --- a/sd/source/ui/func/funavig.cxx +++ b/sd/source/ui/func/funavig.cxx @@ -167,7 +167,7 @@ void FuNavigation::DoExecute( SfxRequest& rReq ) mrDoc.GetSdPageCount(PageKind::Standard)); rtl::Reference<FuNavigation> xThis( this ); // avoid destruction within async processing - weld::DialogController::runAsync(xDialog, [xDialog, xRequest, xThis](sal_uInt32 nResult) { + weld::DialogController::runAsync(xDialog, [xDialog, xRequest=std::move(xRequest), xThis](sal_uInt32 nResult) { if (nResult == RET_OK) { DrawViewShell& rDrawViewShell2 = dynamic_cast<DrawViewShell&>(xThis->mrViewShell); diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index d483a341804b..012d0a418cb1 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -4470,7 +4470,7 @@ void SfxMedium::SignContents_Impl(weld::Window* pDialogParent, xModelSigner->SignScriptingContentAsync( GetScriptingStorageToSign_Impl(), xStream, [this, xSigner, xMetaInf, xWriteableZipStor, - onSignDocumentContentFinished](bool bRet) { + onSignDocumentContentFinished=std::move(onSignDocumentContentFinished)](bool bRet) { // remove the document signature if any OUString aDocSigName = xSigner->getDocumentContentSignatureDefaultStreamName(); if ( !aDocSigName.isEmpty() && xMetaInf->hasByName( aDocSigName ) ) @@ -4559,8 +4559,9 @@ void SfxMedium::SignContents_Impl(weld::Window* pDialogParent, } // Async, all code before return has to go into the callback. - xModelSigner->SignDocumentContentAsync(GetZipStorageToSign_Impl(), - xStream, pViewShell, [onODFSignDocumentContentFinished, onSignDocumentContentFinished](bool bRet) { + xModelSigner->SignDocumentContentAsync(GetZipStorageToSign_Impl(), xStream, pViewShell, + [onODFSignDocumentContentFinished, + onSignDocumentContentFinished=std::move(onSignDocumentContentFinished)](bool bRet) { if (bRet) { onODFSignDocumentContentFinished(); @@ -4600,7 +4601,9 @@ void SfxMedium::SignContents_Impl(weld::Window* pDialogParent, { // We need read-write to be able to add the signature relation. xModelSigner->SignDocumentContentAsync( - GetZipStorageToSign_Impl(/*bReadOnly=*/false), xStream, pViewShell, [onOOXMLSignDocumentContentFinished, onSignDocumentContentFinished](bool bRet) { + GetZipStorageToSign_Impl(/*bReadOnly=*/false), xStream, pViewShell, + [onOOXMLSignDocumentContentFinished, + onSignDocumentContentFinished=std::move(onSignDocumentContentFinished)](bool bRet) { if (bRet) { onOOXMLSignDocumentContentFinished(); @@ -4622,7 +4625,8 @@ void SfxMedium::SignContents_Impl(weld::Window* pDialogParent, // Something not ZIP based: e.g. PDF. std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(GetName(), StreamMode::READ | StreamMode::WRITE)); uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(std::move(pStream))); - xModelSigner->SignDocumentContentAsync(uno::Reference<embed::XStorage>(), xStream, pViewShell, [onSignDocumentContentFinished](bool bRet) { + xModelSigner->SignDocumentContentAsync(uno::Reference<embed::XStorage>(), xStream, pViewShell, + [onSignDocumentContentFinished=std::move(onSignDocumentContentFinished)](bool bRet) { onSignDocumentContentFinished(bRet); }); return; diff --git a/slideshow/source/engine/animationnodes/animationbasenode.cxx b/slideshow/source/engine/animationnodes/animationbasenode.cxx index 7d2f67203904..16d113850417 100644 --- a/slideshow/source/engine/animationnodes/animationbasenode.cxx +++ b/slideshow/source/engine/animationnodes/animationbasenode.cxx @@ -443,8 +443,8 @@ AnimationBaseNode::fillCommonParameters() const // calc accel/decel: double nAcceleration = 0.0; double nDeceleration = 0.0; - BaseNodeSharedPtr const pSelf( getSelf() ); - for ( std::shared_ptr<BaseNode> pNode( pSelf ); + BaseNodeSharedPtr xSelf( getSelf() ); + for ( std::shared_ptr<BaseNode> pNode( xSelf ); pNode; pNode = pNode->getParentNode() ) { uno::Reference<animations::XAnimationNode> const xAnimationNode( @@ -456,8 +456,8 @@ AnimationBaseNode::fillCommonParameters() const } EventSharedPtr pEndEvent; - if (pSelf) { - pEndEvent = makeEvent( [pSelf] () {pSelf->deactivate(); }, + if (xSelf) { + pEndEvent = makeEvent( [xSelf=std::move(xSelf)] () {xSelf->deactivate(); }, u"AnimationBaseNode::deactivate"_ustr); } diff --git a/slideshow/source/engine/animationnodes/animationsetnode.cxx b/slideshow/source/engine/animationnodes/animationsetnode.cxx index 45a6005c6f48..0e8ef71d0fed 100644 --- a/slideshow/source/engine/animationnodes/animationsetnode.cxx +++ b/slideshow/source/engine/animationnodes/animationsetnode.cxx @@ -50,12 +50,12 @@ AnimationActivitySharedPtr AnimationSetNode::createActivity() const // AnimationBaseNode::fillCommonParameters() has set up // immediate deactivation as default when activity ends, but if (! isIndefiniteTiming( xAnimateNode->getDuration() )) { - std::shared_ptr<AnimationSetNode> const pSelf( + std::shared_ptr<AnimationSetNode> xSelf( std::dynamic_pointer_cast<AnimationSetNode>(getSelf()) ); ENSURE_OR_THROW( - pSelf, "cannot cast getSelf() to my type!" ); + xSelf, "cannot cast getSelf() to my type!" ); aParms.mpEndEvent = makeEvent( - [pSelf] () { pSelf->scheduleDeactivationEvent(); }, + [xSelf=std::move(xSelf)] () { xSelf->scheduleDeactivationEvent(); }, u"AnimationSetNode::scheduleDeactivationEvent"_ustr); } diff --git a/svx/source/gallery2/galleryfilestorage.cxx b/svx/source/gallery2/galleryfilestorage.cxx index 5295492ca3be..aab66a4af491 100644 --- a/svx/source/gallery2/galleryfilestorage.cxx +++ b/svx/source/gallery2/galleryfilestorage.cxx @@ -520,8 +520,7 @@ SgaObjectBmp GalleryFileStorage::insertGraphic(const Graphic& rGraphic, const Gf } if (bRet) { - const SgaObjectBmp aObjBmp(aURL); - return aObjBmp; + return SgaObjectBmp(aURL); } return SgaObjectBmp(); } diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx index 00864c6efacb..ec3d307067b9 100644 --- a/svx/source/sidebar/nbdtmg.cxx +++ b/svx/source/sidebar/nbdtmg.cxx @@ -438,7 +438,7 @@ void NumberingTypeMgr::Init() pNumEntry->pNumSetting = pNew; if ( i < 8 ) pNumEntry->sDescription = SvxResId(RID_SVXSTR_SINGLENUM_DESCRIPTIONS[i]); - maNumberSettingsArr.push_back(pNumEntry); + maNumberSettingsArr.push_back(std::move(pNumEntry)); } } catch(Exception&) diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx index 9d75508a1ee6..a9c53c50cf1f 100644 --- a/sw/source/ui/dbui/createaddresslistdialog.cxx +++ b/sw/source/ui/dbui/createaddresslistdialog.cxx @@ -290,7 +290,7 @@ SwCreateAddressListDialog::SwCreateAddressListDialog( else aNewData.push_back(sData); } - m_pCSVData->aDBData.push_back( aNewData ); + m_pCSVData->aDBData.push_back(std::move(aNewData)); } } } diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx b/sw/source/uibase/docvw/HeaderFooterWin.cxx index f6de9706d4b2..ebad3ae4c3a5 100644 --- a/sw/source/uibase/docvw/HeaderFooterWin.cxx +++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx @@ -431,11 +431,11 @@ void SwHeaderFooterWin::PaintButton() drawinglayer::primitive2d::Primitive2DContainer aGhostedSeq; double nFadeRate = double(m_nFadeRate) / 100.0; - const basegfx::BColorModifierSharedPtr aBColorModifier = + basegfx::BColorModifierSharedPtr aBColorModifier = std::make_shared<basegfx::BColorModifier_interpolate>(COL_WHITE.getBColor(), 1.0 - nFadeRate); - aGhostedSeq.push_back(new drawinglayer::primitive2d::ModifiedColorPrimitive2D(std::move(aSeq), aBColorModifier)); + aGhostedSeq.push_back(new drawinglayer::primitive2d::ModifiedColorPrimitive2D(std::move(aSeq), std::move(aBColorModifier))); pProcessor->process(aGhostedSeq); diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index eb2190c0f519..c9fc94ce4c9c 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -522,7 +522,8 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) auto xRequest = std::make_shared<SfxRequest>(rReq); rReq.Ignore(); // the 'old' request is not relevant any more pDlg->StartExecuteAsync( - [this, pDlg, xRequest=std::move(xRequest), nEEWhich, aNewAttr2=aNewAttr, pOLV] (sal_Int32 nResult) mutable ->void + [this, pDlg, xRequest=std::move(xRequest), nEEWhich, + aNewAttr2=std::move(aNewAttr), pOLV] (sal_Int32 nResult) mutable ->void { if (nResult == RET_OK) { diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index 9d9809e7ecaa..bbf3ecba17d4 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -413,7 +413,8 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) auto xRequest = std::make_shared<SfxRequest>(rReq); rReq.Ignore(); // the 'old' request is not relevant any more pDlg->StartExecuteAsync( - [this, pDlg, xRequest=std::move(xRequest), nEEWhich, aNewAttr2=aNewAttr, pOLV, bRestoreSelection, aOldSelection] (sal_Int32 nResult) mutable ->void + [this, pDlg, xRequest=std::move(xRequest), nEEWhich, + aNewAttr2=std::move(aNewAttr), pOLV, bRestoreSelection, aOldSelection] (sal_Int32 nResult) mutable ->void { if (nResult == RET_OK) { diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx index 1aac739ab3ed..2e56bfcb02a4 100644 --- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx +++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx @@ -648,7 +648,7 @@ static void UpdateTree(SwDocShell& rDocSh, const SwEditShell& rEditSh, InsertValues(xPropertiesSet, aIsDefined, aCurrentChild, aParentParaStyle.isEmpty(), aHiddenCharacterProperties, aFieldsNode); - aParaNode.children.push_back(aCurrentChild); + aParaNode.children.push_back(std::move(aCurrentChild)); sCurrentParaStyle = aParentParaStyle; }