Date: Tuesday, November 23, 2021 @ 15:44:31 Author: kgizdov Revision: 1054473
upgpkg: root 6.24.06-6: updated nonnull patch Modified: root/trunk/9271.patch root/trunk/PKGBUILD ------------+ 9271.patch | 53 ++++++++++++++++++++++++++++++++++++++++------------- PKGBUILD | 4 ++-- 2 files changed, 42 insertions(+), 15 deletions(-) Modified: 9271.patch =================================================================== --- 9271.patch 2021-11-23 15:35:57 UTC (rev 1054472) +++ 9271.patch 2021-11-23 15:44:31 UTC (rev 1054473) @@ -1,8 +1,30 @@ +From ef095d953b7632654dcd93aa3151508dfefa22d3 Mon Sep 17 00:00:00 2001 +From: Konstantin Gizdov <kgiz...@gmail.com> +Date: Thu, 11 Nov 2021 01:57:36 +0200 +Subject: [PATCH] backport 'address some -Wnonnull issue and follow-up + improvements' to v6-24-00-patches + +RooFit::HistFactory::ConfigParser: fix null dereferences, improve logic, modernise, fix some edge cases, optimise performance +RooAddModel: fix null dereferences +TMVA::DataLoader: calling .front() in an empty container is undefined, fix also null ptr dereference +RooDataHist and RooRealSumFunc fixes for null dereferences +RooAbsCollection: safer Int_t getSize() and RooAbsArg* front(), offer alternatives +RooDataHist::_adjustBinning throw std::logic_error when pass type is not derived from real +clang-format applied +--- + roofit/histfactory/src/ConfigParser.cxx | 469 ++++++++---------- + roofit/roofitcore/inc/RooAbsCollection.h | 17 +- + roofit/roofitcore/src/RooAddModel.cxx | 114 +++-- + roofit/roofitcore/src/RooDataHist.cxx | 15 +- + roofit/roofitcore/src/RooRealSumFunc.cxx | 5 +- + .../Architectures/Reference/DataLoader.cxx | 12 + + 6 files changed, 299 insertions(+), 333 deletions(-) + diff --git a/roofit/histfactory/src/ConfigParser.cxx b/roofit/histfactory/src/ConfigParser.cxx -index 227a16b6a0..f1d7eba4f4 100644 +index 227a16b6a0a9..3ec032579037 100644 --- a/roofit/histfactory/src/ConfigParser.cxx +++ b/roofit/histfactory/src/ConfigParser.cxx -@@ -260,280 +260,210 @@ std::vector< RooStats::HistFactory::Measurement > ConfigParser::GetMeasurementsF +@@ -260,280 +260,215 @@ std::vector< RooStats::HistFactory::Measurement > ConfigParser::GetMeasurementsF return measurement_list; } @@ -104,7 +126,8 @@ + TXMLAttr *curAttr = nullptr; + while ((/**/ curAttr = dynamic_cast<TXMLAttr *>(attribIt()) /**/) != nullptr) { + // curAttr is guaranteed non-null above -+ const std::string curAttrName(curAttr->GetName()), curAttrValue(curAttr->GetValue()); ++ const std::string curAttrName(curAttr->GetName() ? curAttr->GetName() : ""), ++ curAttrValue(curAttr->GetValue() ? curAttr->GetValue() : ""); + if (curAttrName == "") { + cxcoutEHF << "Found XML attribute in Measurement with no name.\n"; + // ADD Output Here @@ -174,7 +197,9 @@ + // Then, get the properties of the children nodes + TXMLNode *child = node->GetChildren(); + while (child != nullptr) { -+ const std::string childName(child->GetName()), childNodeName(child->GetNodeName()), childText(child->GetText()); ++ const std::string childName(child->GetName() ? child->GetName() : ""), ++ childNodeName(child->GetNodeName() ? child->GetNodeName() : ""), ++ childText(child->GetText() ? child->GetText() : ""); + if (childNodeName.empty()) { + cxcoutEHF << "Found XML child node of Measurement with no name\n"; + throw hf_exc(); @@ -190,7 +215,7 @@ + TXMLAttr *curParam = nullptr; + while ((/**/ curParam = dynamic_cast<TXMLAttr *>(paramIt()) /**/) != nullptr) { + // curParam is guaranteed non-null above -+ const std::string curParamName(curParam->GetName()); ++ const std::string curParamName(curParam->GetName() ? curParam->GetName() : ""); + if (curParamName.empty()) { + cxcoutEHF << "Error: Found tag attribute with no name in ParamSetting\n"; + throw hf_exc(); @@ -228,7 +253,8 @@ + attribIt = child->GetAttributes(); + curAttr = nullptr; + while ((/**/ curAttr = dynamic_cast<TXMLAttr *>(attribIt()) /**/) != nullptr) { -+ const std::string curAttrName(curAttr->GetName()), curAttrValue(curAttr->GetValue()); ++ const std::string curAttrName(curAttr->GetName() ? curAttr->GetName() : ""), ++ curAttrValue(curAttr->GetValue() ? curAttr->GetValue() : ""); + if (curAttrName.empty()) { + cxcoutEHF << "Error: Found tag attribute with no name in ConstraintTerm\n"; + throw hf_exc(); @@ -267,7 +293,8 @@ + attribIt = child->GetAttributes(); + curAttr = nullptr; + while ((/**/ curAttr = dynamic_cast<TXMLAttr *>(attribIt()) /**/) != nullptr) { -+ const std::string curAttrName(curAttr->GetName()), curAttrValue(curAttr->GetValue()); ++ const std::string curAttrName(curAttr->GetName() ? curAttr->GetName() : ""), ++ curAttrValue(curAttr->GetValue() ? curAttr->GetValue() : ""); + if (curAttrName.empty()) { + cxcoutEHF << "Error: Found tag attribute with no name in ConstraintTerm\n"; + throw hf_exc(); @@ -481,10 +508,10 @@ /* diff --git a/roofit/roofitcore/inc/RooAbsCollection.h b/roofit/roofitcore/inc/RooAbsCollection.h -index 5c2d733a06..0ea54abd33 100644 +index 5c2d733a0674..0ea54abd33b4 100644 --- a/roofit/roofitcore/inc/RooAbsCollection.h +++ b/roofit/roofitcore/inc/RooAbsCollection.h -@@ -179,14 +179,17 @@ public: +@@ -179,14 +179,17 @@ class RooAbsCollection : public TObject, public RooPrintable { removeAll(); } @@ -510,7 +537,7 @@ RooAbsArg * operator[](Storage_t::size_type i) const { diff --git a/roofit/roofitcore/src/RooAddModel.cxx b/roofit/roofitcore/src/RooAddModel.cxx -index cc72e8e55a..ce072f9eb7 100644 +index cc72e8e55aa2..ce072f9eb745 100644 --- a/roofit/roofitcore/src/RooAddModel.cxx +++ b/roofit/roofitcore/src/RooAddModel.cxx @@ -97,63 +97,71 @@ RooAddModel::RooAddModel(const char *name, const char *title, const RooArgList& @@ -639,7 +666,7 @@ /// Copy constructor diff --git a/roofit/roofitcore/src/RooDataHist.cxx b/roofit/roofitcore/src/RooDataHist.cxx -index 5bd49acdbe..3b132c7766 100644 +index 5bd49acdbeab..3b132c776695 100644 --- a/roofit/roofitcore/src/RooDataHist.cxx +++ b/roofit/roofitcore/src/RooDataHist.cxx @@ -573,10 +573,17 @@ void RooDataHist::importDHistSet(const RooArgList& /*vars*/, RooCategory& indexC @@ -665,7 +692,7 @@ const double xlo = theirVar.getMin(); const double xhi = theirVar.getMax(); diff --git a/roofit/roofitcore/src/RooRealSumFunc.cxx b/roofit/roofitcore/src/RooRealSumFunc.cxx -index cbff7435b6..6e9fa40f5d 100644 +index cbff7435b648..6e9fa40f5da5 100644 --- a/roofit/roofitcore/src/RooRealSumFunc.cxx +++ b/roofit/roofitcore/src/RooRealSumFunc.cxx @@ -152,8 +152,9 @@ RooRealSumFunc::RooRealSumFunc(const char *name, const char *title, const RooArg @@ -681,7 +708,7 @@ } _funcList.add(*func); diff --git a/tmva/tmva/src/DNN/Architectures/Reference/DataLoader.cxx b/tmva/tmva/src/DNN/Architectures/Reference/DataLoader.cxx -index 2465abf308..1724805382 100644 +index 2465abf3085f..1724805382ac 100644 --- a/tmva/tmva/src/DNN/Architectures/Reference/DataLoader.cxx +++ b/tmva/tmva/src/DNN/Architectures/Reference/DataLoader.cxx @@ -145,6 +145,9 @@ void TDataLoader<TMVAInput_t, TReference<Real_t>>::CopyInput(TMatrixT<Real_t> &m Modified: PKGBUILD =================================================================== --- PKGBUILD 2021-11-23 15:35:57 UTC (rev 1054472) +++ PKGBUILD 2021-11-23 15:44:31 UTC (rev 1054473) @@ -7,7 +7,7 @@ pkgbase=root pkgname=('root' 'root-cuda') pkgver=6.24.06 -pkgrel=5 +pkgrel=6 pkgdesc='C++ data analysis framework and interpreter from CERN' arch=('x86_64') url='https://root.cern' @@ -108,7 +108,7 @@ '1c905ee7a3f8f5f3f567d957f9be6b503a8631565d4d9b9bfea5e496ef86865c5a8be1a1f8c7842754029879cf0afd2465249f532a116cc43660aa2e460ae682' '12814f50b7016bd86d3f91e0e31c052783a0c0fa72b7d6a072d3ae6f86c2437323d585e531235377ebbfdd9cb76abd7da84d9631de821151547f1d4b13417e69' '870740fbbd678056dd71b275c5d96f9b0db503ca8e0e9e84f784c3115aae66bb28a1eb531f665c1c8306a52686e5ce484ef65b3194bef6cb0d631664ccb1e3f9' - 'c31ac51da9acbde068dea230e30445e0428a082c56f2e899ffc1113ed4c391a165cbe54c5d6d0fe9858bfd2ed177075349ab749d0c5b8c68413dd852a398da2d' + '6ba0994fa62d9a59a6382b9beafd044d0fb7bd45048c531d0437844a98f7ef40dcd45565670cb5a7adc7dc040885d3b7dbea73448ba1cd30fb9764d4f0890cd5' '3b9e382480b28f60af0b096ac9a42e6ba611b899717988bdebffd5aeabab054e37a28a7421f4a0f39198638c31f56a657a8a9ccc3db54a87daf50d43d35b1ca9') get_pyver () {