mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
fix for ZAM "assert" statements potentially evaluating invalid expressions
This commit is contained in:
parent
682789a8e9
commit
e6e31bc25a
3 changed files with 10 additions and 3 deletions
|
@ -1062,6 +1062,9 @@ const ZAMStmt ZAMCompiler::CompileAssert(const AssertStmt* as) {
|
||||||
|
|
||||||
(void)AddInst(ZInstI(OP_SHOULD_REPORT_ASSERT_VV, decision_slot, cond_slot));
|
(void)AddInst(ZInstI(OP_SHOULD_REPORT_ASSERT_VV, decision_slot, cond_slot));
|
||||||
|
|
||||||
|
auto cond_stmt = AddInst(ZInstI(OP_IF_Vb, decision_slot, 0));
|
||||||
|
AddCFT(insts1.back(), CFT_IF);
|
||||||
|
|
||||||
ZInstI z;
|
ZInstI z;
|
||||||
|
|
||||||
// We don't have a convenient way of directly introducing a std::string
|
// We don't have a convenient way of directly introducing a std::string
|
||||||
|
@ -1085,7 +1088,11 @@ const ZAMStmt ZAMCompiler::CompileAssert(const AssertStmt* as) {
|
||||||
else
|
else
|
||||||
z = ZInstI(OP_REPORT_ASSERT_VVC, decision_slot, cond_slot, cond_desc_e.get());
|
z = ZInstI(OP_REPORT_ASSERT_VVC, decision_slot, cond_slot, cond_desc_e.get());
|
||||||
|
|
||||||
return AddInst(z);
|
auto end_inst = AddInst(z);
|
||||||
|
AddCFT(insts1.back(), CFT_BLOCK_END);
|
||||||
|
SetV(cond_stmt, GoToTargetBeyond(end_inst), 2);
|
||||||
|
|
||||||
|
return end_inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ZAMStmt ZAMCompiler::InitRecord(IDPtr id, RecordType* rt) {
|
const ZAMStmt ZAMCompiler::InitRecord(IDPtr id, RecordType* rt) {
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||||
runtime error in <...>/assert.zeek, line 9: field value missing: $b
|
error in <...>/assert.zeek, line 10: assertion failure: r?$b (r$b is not set in [a=1234, b=<uninitialized>])
|
||||||
fatal error: errors occurred while initializing
|
fatal error: errors occurred while initializing
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||||
runtime error in <...>/assert.zeek, line 9: field value missing: $b
|
runtime error in <...>/assert.zeek, line 12: field value missing: $b
|
||||||
fatal error: errors occurred while initializing
|
fatal error: errors occurred while initializing
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue