check: bounds-check roslice peeks, not just slice

This commit is contained in:
Nigel Tao committed 2024-04-23 23:19:25 +10:00
1 parent 92ff96359a
commit bf3afab25a
1 file changed
+1 -1
+1 -1
View File
@@ -1259,7 +1259,7 @@ func (q *checker) bcheckExprCallSpecialCases(n *a.Expr, depth uint32) (bounds, e
}
}
} else if recvTyp.Eq(typeExprSliceU8) {
} else if recvTyp.Eq(typeExprSliceU8) || recvTyp.Eq(typeExprRosliceU8) {
if method >= t.IDPeekU8 {
if m := method - t.IDPeekU8; m < t.ID(len(ioMethodAdvances)) {
au := ioMethodAdvances[m]