Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid use of uninitalized values in GBRForestTools #35705

Merged
merged 1 commit into from Oct 19, 2021

Conversation

Dr15Jones
Copy link
Contributor

PR description:

Calls to XMLElement::Query*Attribute do not set the passed in variable if there was a problem. So we either need to initialize the variable before hand or check for errors.

This was found by the compiler in the USBAN build.

PR validation:

Code compiles.

Calls to XMLElement::Query*Attribute do not set the passed in
variable if there was a problem. So we either need to initialize
the variable before hand or check for errors.
bool ctype;
int selector = 0;
float cutval = 0.;
bool ctype = false;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: I initialized the variables here rather than doing error checking as there is no error handling what so ever in this function and I didn't want to make a larger change.

@@ -194,7 +200,10 @@ namespace {
e = e->NextSiblingElement("BinaryTree")) {
hasTrees = true;
double w;
e->QueryDoubleAttribute("boostWeight", &w);
if (tinyxml2::XML_SUCCESS != e->QueryDoubleAttribute("boostWeight", &w)) {
throw cms::Exception("XMLERROR") << "problem with 'boostWeight' attribute found in 'BinaryTree' element in "
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could fail because the attribute is missing or the value could not be converted to a double. I didn't feel it was worth the effort to distinguish the two.

@Dr15Jones
Copy link
Contributor Author

@smuzaffar FYI

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-35705/26011

  • This PR adds an extra 12KB to repository

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @Dr15Jones (Chris Jones) for master.

It involves the following packages:

  • CommonTools/MVAUtils (reconstruction)

@jpata, @cmsbuild, @slava77 can you please review it and eventually sign? Thanks.
@perrotta, @dpiparo, @qliphy you are the release manager for this.

cms-bot commands are listed here

@Dr15Jones
Copy link
Contributor Author

please test

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-ccb759/19690/summary.html
COMMIT: ef94ed3
CMSSW: CMSSW_12_1_X_2021-10-16-1100/slc7_amd64_gcc900
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/35705/19690/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 4 differences found in the comparisons
  • DQMHistoTests: Total files compared: 40
  • DQMHistoTests: Total histograms compared: 2751113
  • DQMHistoTests: Total failures: 5
  • DQMHistoTests: Total nulls: 1
  • DQMHistoTests: Total successes: 2751085
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: -0.004 KiB( 39 files compared)
  • DQMHistoSizes: changed ( 312.0 ): -0.004 KiB MessageLogger/Warnings
  • Checked 170 log files, 37 edm output root files, 40 DQM output files
  • TriggerResults: no differences found

@slava77
Copy link
Contributor

slava77 commented Oct 19, 2021

+reconstruction

for #35705 ef94ed3

  • code changes are essentially technical, in line with the PR description: initializations were added together with error checking that throws exceptions
  • jenkins tests pass

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @perrotta, @dpiparo, @qliphy (and backports should be raised in the release meeting by the corresponding L2)

@perrotta
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit 3c60d77 into cms-sw:master Oct 19, 2021
@Dr15Jones Dr15Jones deleted the fixUninitGBRForestTools branch October 20, 2021 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants