mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-23 08:47:56 +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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func dropExprCachedMBounds(n *Node) error {
|
||||||
|
if n.kind == KExpr {
|
||||||
|
n.mBounds = interval.IntRange{nil, nil}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type Loop interface {
|
type Loop interface {
|
||||||
AsNode() *Node
|
AsNode() *Node
|
||||||
HasBreak() bool
|
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) Condition() *Expr { return n.rhs.AsExpr() }
|
||||||
func (n *Assert) Args() []*Node { return n.list0 }
|
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 {
|
func NewAssert(keyword t.ID, condition *Expr, reason t.ID, args []*Node) *Assert {
|
||||||
return &Assert{
|
return &Assert{
|
||||||
kind: KAssert,
|
kind: KAssert,
|
||||||
|
|||||||
@@ -357,6 +357,10 @@ func (q *checker) hasIsErrorFact(id t.ID) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (q *checker) bcheckAssert(n *a.Assert) error {
|
func (q *checker) bcheckAssert(n *a.Assert) error {
|
||||||
|
if err := n.DropExprCachedMBounds(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
condition := n.Condition()
|
condition := n.Condition()
|
||||||
if _, err := q.bcheckExpr(condition, 0); err != nil {
|
if _, err := q.bcheckExpr(condition, 0); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -21066,7 +21066,7 @@ wuffs_json__decoder__decode_tokens(wuffs_json__decoder* self,
|
|||||||
(((uint64_t)(1))
|
(((uint64_t)(1))
|
||||||
<< WUFFS_BASE__TOKEN__LENGTH__SHIFT));
|
<< WUFFS_BASE__TOKEN__LENGTH__SHIFT));
|
||||||
(iop_a_src += 1, wuffs_base__make_empty_struct());
|
(iop_a_src += 1, wuffs_base__make_empty_struct());
|
||||||
goto label__string_loop_inner__continue;
|
goto label__string_loop_outer__continue;
|
||||||
}
|
}
|
||||||
status =
|
status =
|
||||||
wuffs_base__make_status(wuffs_json__error__bad_utf_8);
|
wuffs_base__make_status(wuffs_json__error__bad_utf_8);
|
||||||
@@ -21122,7 +21122,7 @@ wuffs_json__decoder__decode_tokens(wuffs_json__decoder* self,
|
|||||||
(((uint64_t)(1))
|
(((uint64_t)(1))
|
||||||
<< WUFFS_BASE__TOKEN__LENGTH__SHIFT));
|
<< WUFFS_BASE__TOKEN__LENGTH__SHIFT));
|
||||||
(iop_a_src += 1, wuffs_base__make_empty_struct());
|
(iop_a_src += 1, wuffs_base__make_empty_struct());
|
||||||
goto label__string_loop_inner__continue;
|
goto label__string_loop_outer__continue;
|
||||||
}
|
}
|
||||||
status =
|
status =
|
||||||
wuffs_base__make_status(wuffs_json__error__bad_utf_8);
|
wuffs_base__make_status(wuffs_json__error__bad_utf_8);
|
||||||
@@ -21183,7 +21183,7 @@ wuffs_json__decoder__decode_tokens(wuffs_json__decoder* self,
|
|||||||
(((uint64_t)(1))
|
(((uint64_t)(1))
|
||||||
<< WUFFS_BASE__TOKEN__LENGTH__SHIFT));
|
<< WUFFS_BASE__TOKEN__LENGTH__SHIFT));
|
||||||
(iop_a_src += 1, wuffs_base__make_empty_struct());
|
(iop_a_src += 1, wuffs_base__make_empty_struct());
|
||||||
goto label__string_loop_inner__continue;
|
goto label__string_loop_outer__continue;
|
||||||
}
|
}
|
||||||
status =
|
status =
|
||||||
wuffs_base__make_status(wuffs_json__error__bad_utf_8);
|
wuffs_base__make_status(wuffs_json__error__bad_utf_8);
|
||||||
@@ -21245,7 +21245,7 @@ wuffs_json__decoder__decode_tokens(wuffs_json__decoder* self,
|
|||||||
(((uint64_t)(3)) << WUFFS_BASE__TOKEN__LINK__SHIFT) |
|
(((uint64_t)(3)) << WUFFS_BASE__TOKEN__LINK__SHIFT) |
|
||||||
(((uint64_t)(1)) << WUFFS_BASE__TOKEN__LENGTH__SHIFT));
|
(((uint64_t)(1)) << WUFFS_BASE__TOKEN__LENGTH__SHIFT));
|
||||||
(iop_a_src += 1, wuffs_base__make_empty_struct());
|
(iop_a_src += 1, wuffs_base__make_empty_struct());
|
||||||
goto label__string_loop_inner__continue;
|
goto label__string_loop_outer__continue;
|
||||||
}
|
}
|
||||||
status = wuffs_base__make_status(wuffs_json__error__bad_utf_8);
|
status = wuffs_base__make_status(wuffs_json__error__bad_utf_8);
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|||||||
@@ -629,7 +629,7 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader) {
|
|||||||
link: 0x3,
|
link: 0x3,
|
||||||
length: 1)
|
length: 1)
|
||||||
args.src.skip32_fast!(actual: 1, worst_case: 1)
|
args.src.skip32_fast!(actual: 1, worst_case: 1)
|
||||||
continue.string_loop_inner
|
continue.string_loop_outer
|
||||||
}
|
}
|
||||||
return "#bad UTF-8"
|
return "#bad UTF-8"
|
||||||
}
|
}
|
||||||
@@ -677,7 +677,7 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader) {
|
|||||||
link: 0x3,
|
link: 0x3,
|
||||||
length: 1)
|
length: 1)
|
||||||
args.src.skip32_fast!(actual: 1, worst_case: 1)
|
args.src.skip32_fast!(actual: 1, worst_case: 1)
|
||||||
continue.string_loop_inner
|
continue.string_loop_outer
|
||||||
}
|
}
|
||||||
return "#bad UTF-8"
|
return "#bad UTF-8"
|
||||||
}
|
}
|
||||||
@@ -730,7 +730,7 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader) {
|
|||||||
link: 0x3,
|
link: 0x3,
|
||||||
length: 1)
|
length: 1)
|
||||||
args.src.skip32_fast!(actual: 1, worst_case: 1)
|
args.src.skip32_fast!(actual: 1, worst_case: 1)
|
||||||
continue.string_loop_inner
|
continue.string_loop_outer
|
||||||
}
|
}
|
||||||
return "#bad UTF-8"
|
return "#bad UTF-8"
|
||||||
}
|
}
|
||||||
@@ -783,7 +783,7 @@ pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader) {
|
|||||||
link: 0x3,
|
link: 0x3,
|
||||||
length: 1)
|
length: 1)
|
||||||
args.src.skip32_fast!(actual: 1, worst_case: 1)
|
args.src.skip32_fast!(actual: 1, worst_case: 1)
|
||||||
continue.string_loop_inner
|
continue.string_loop_outer
|
||||||
}
|
}
|
||||||
return "#bad UTF-8"
|
return "#bad UTF-8"
|
||||||
} endwhile.string_loop_inner
|
} endwhile.string_loop_inner
|
||||||
|
|||||||
Reference in new issue
Block a user