mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 08:47:28 +01:00
Drop cached expr MBounds when re-checking asserts
Updates https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=21371
This commit is contained in:
1 parent
58351d44da
commit
40d200cdab
4 files changed
+21
-8
No files matched your search
@@ -236,6 +236,13 @@ func (n *Node) Walk(f func(*Node) error) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func dropExprCachedMBounds(n *Node) error {
|
||||
if n.kind == KExpr {
|
||||
n.mBounds = interval.IntRange{nil, nil}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Loop interface {
|
||||
AsNode() *Node
|
||||
HasBreak() bool
|
||||
@@ -390,6 +397,8 @@ func (n *Assert) Reason() t.ID { return n.id2 }
|
||||
func (n *Assert) Condition() *Expr { return n.rhs.AsExpr() }
|
||||
func (n *Assert) Args() []*Node { return n.list0 }
|
||||
|
||||
func (n *Assert) DropExprCachedMBounds() error { return n.AsNode().Walk(dropExprCachedMBounds) }
|
||||
|
||||
func NewAssert(keyword t.ID, condition *Expr, reason t.ID, args []*Node) *Assert {
|
||||
return &Assert{
|
||||
kind: KAssert,
|
||||
|
||||
@@ -357,6 +357,10 @@ func (q *checker) hasIsErrorFact(id t.ID) bool {
|
||||
}
|
||||
|
||||
func (q *checker) bcheckAssert(n *a.Assert) error {
|
||||
if err := n.DropExprCachedMBounds(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
condition := n.Condition()
|
||||
if _, err := q.bcheckExpr(condition, 0); err != nil {
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user