Skip to content

Commit cfff82b

Browse files
authored
Merge commit from fork
DerefExpression: Add missing nullptr check
2 parents 56255ac + a02a459 commit cfff82b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/config/expression.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ bool DerefExpression::GetReference(ScriptFrame& frame, bool init_dict, Value *pa
187187

188188
Reference::Ptr ref = operand.GetValue();
189189

190+
if (!ref) {
191+
BOOST_THROW_EXCEPTION(ScriptError("Invalid reference specified.", GetDebugInfo()));
192+
}
193+
190194
*parent = ref->GetParent();
191195
*index = ref->GetIndex();
192196
return true;

test/config-ops.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@ BOOST_AUTO_TEST_CASE(advanced)
242242
expr = ConfigCompiler::CompileText("<test>", "{{ 3 }}");
243243
func = expr->Evaluate(frame).GetValue();
244244
BOOST_CHECK(func->Invoke() == 3);
245+
246+
// Regression test for CVE-2025-61908
247+
expr = ConfigCompiler::CompileText("<test>", "&*null");
248+
BOOST_CHECK_THROW(expr->Evaluate(frame).GetValue(), ScriptError);
245249
}
246250

247251
BOOST_AUTO_TEST_CASE(sandboxed_ticket_salt)

0 commit comments

Comments
 (0)