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

prevent heap-buffer-overflow in SiPixelDynamicInefficiencyPUParametrization #40944

Merged
merged 1 commit into from
Mar 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -819,10 +819,25 @@ namespace {
int npar = n + 2;
TF1* f1 =
new TF1((fmt::sprintf("region: #bf{%s}", namesOfParts[index - 1])).c_str(), func, xmin_, xmax_, npar);

// push polynomial degree as first entry in the vector
params.insert(params.begin(), n);

// TF1::SetParameters needs a C-style array
double* arr = params.data();
f1->SetLineWidth(2);
f1->SetParameters(arr);

if (n == 1) {
/* special case for constant
using setParameters technically works, but leads to
heap-buffer-overflow
*/
f1->SetParameter(0, arr[0]);
f1->SetParameter(1, arr[1]);
} else {
f1->SetParameters(arr);
}

parametrizations.push_back(f1);

// build the formula to be displayed
Expand Down