mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 16:55:11 +01:00
Bounds check the components of a s[i:j] expr
This commit is contained in:
1 parent
5e856540bd
commit
30e48093fc
2 files changed
+15
-2
No files matched your search
@@ -877,8 +877,22 @@ func (q *checker) bcheckExprOther(n *a.Expr, depth uint32) (*big.Int, *big.Int,
|
|||||||
|
|
||||||
case t.IDColon:
|
case t.IDColon:
|
||||||
lhs := n.LHS().Expr()
|
lhs := n.LHS().Expr()
|
||||||
|
if _, _, err := q.bcheckExpr(lhs, depth); err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
mhs := n.MHS().Expr()
|
mhs := n.MHS().Expr()
|
||||||
|
if mhs != nil {
|
||||||
|
if _, _, err := q.bcheckExpr(mhs, depth); err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
rhs := n.RHS().Expr()
|
rhs := n.RHS().Expr()
|
||||||
|
if rhs != nil {
|
||||||
|
if _, _, err := q.bcheckExpr(rhs, depth); err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if mhs == nil && rhs == nil {
|
if mhs == nil && rhs == nil {
|
||||||
return nil, nil, nil
|
return nil, nil, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -432,8 +432,7 @@ pri func decoder.decode_id_part1?(ib ptr base.image_buffer, dst base.io_writer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: have a builtin btoi or "b as base.u32"?
|
// TODO: have a builtin btoi or "b as base.u32"?
|
||||||
// TODO: p's type should be base.u32[..1]
|
var p base.u32[..1] = 0
|
||||||
var p base.u32 = 0
|
|
||||||
if this.have_lct {
|
if this.have_lct {
|
||||||
p = 1
|
p = 1
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user