From 4dfba277487a7023ab9f5783302da4a9b5e9bef8 Mon Sep 17 00:00:00 2001 From: "Jiao, Joey" Date: Wed, 6 Nov 2024 13:41:21 +0800 Subject: all: support || operator in syzlang if condition ex. f3 field has logic or operator in if condition: conditional_struct { mask int32 f1 field1 (if[value[mask] & FIELD_FLAG1]) f2 int64 (if[value[mask] & FIELD_FLAG2]) f3 int64 (if[value[mask] == FIELD_FLAG1 || value[mask] == FIELD_FLAG2]) } [packed] --- prog/expr.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'prog/expr.go') diff --git a/prog/expr.go b/prog/expr.go index e9446ab2c..87fb056a9 100644 --- a/prog/expr.go +++ b/prog/expr.go @@ -30,6 +30,11 @@ func (bo *BinaryExpression) Evaluate(finder ArgFinder) (uint64, bool) { return 0, true case OperatorBinaryAnd: return left & right, true + case OperatorOr: + if left != 0 || right != 0 { + return 1, true + } + return 0, true } panic(fmt.Sprintf("unknown operator %q", bo.Operator)) } -- cgit mrf-deployment