[Thermo] Fix possible invalid read in installShomateThermoFromXML
installShomateThermoFromXML now checks that 7 coefficients are supplied in the floatArray and throws if that is not the case. Partial cherry-pick of r2778.
This commit is contained in:
parent
7f5ea6edb3
commit
98d113182b
1 changed files with 10 additions and 0 deletions
|
|
@ -462,6 +462,11 @@ static void installShomateThermoFromXML(const std::string& speciesName, SpeciesT
|
|||
if (dualRange) {
|
||||
getFloatArray(f1ptr->child("floatArray"), c1, false);
|
||||
} else {
|
||||
if(c0.size() != 7)
|
||||
{
|
||||
throw CanteraError("installShomateThermoFromXML",
|
||||
"Shomate thermo requires 7 coefficients in float array.");
|
||||
}
|
||||
c1.resize(7,0.0);
|
||||
copy(c0.begin(), c0.begin()+7, c1.begin());
|
||||
}
|
||||
|
|
@ -475,6 +480,11 @@ static void installShomateThermoFromXML(const std::string& speciesName, SpeciesT
|
|||
throw CanteraError("installShomateThermoFromXML",
|
||||
"non-continuous temperature ranges.");
|
||||
}
|
||||
if(c0.size() != 7 || c1.size() != 7)
|
||||
{
|
||||
throw CanteraError("installShomateThermoFromXML",
|
||||
"Shomate thermo requires 7 coefficients in float array.");
|
||||
}
|
||||
vector_fp c(15);
|
||||
c[0] = tmid;
|
||||
copy(c0.begin(), c0.begin()+7, c.begin() + 1);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue