avoid out-of-range read

This commit is contained in:
Axel Kohlmeyer
2022-12-28 00:12:45 -05:00
parent 50a370c4a5
commit 67156420d4
2 changed files with 4 additions and 4 deletions

View File

@ -611,7 +611,7 @@ void CompiledVectorExpression::generateJitCode() {
// Find the constant value (if any) used by this operation.
Operation& op = *operation[step];
double value;
double value = 0.0;
if (op.getId() == Operation::CONSTANT)
value = dynamic_cast<Operation::Constant&> (op).getValue();
else if (op.getId() == Operation::ADD_CONSTANT)
@ -626,7 +626,7 @@ void CompiledVectorExpression::generateJitCode() {
value = 1.0;
else if (op.getId() == Operation::ABS) {
int mask = 0x7FFFFFFF;
memcpy(&value, &mask, sizeof(value));
memcpy(&value, &mask, sizeof(mask));
}
else if (op.getId() == Operation::POWER_CONSTANT) {
if (stepGroup[step] == -1)