mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 00:32:11 +01:00
lang: reject 0-length arrays
This commit is contained in:
1 parent
4a2f570d56
commit
e930d66897
1 file changed
+3
-1
+3
-1
@@ -1186,8 +1186,10 @@ swtch:
|
||||
if err := q.tcheckExpr(aLen, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if aLen.ConstValue() == nil {
|
||||
if cv := aLen.ConstValue(); cv == nil {
|
||||
return fmt.Errorf("check: %q is not constant", aLen.Str(q.tm))
|
||||
} else if cv.Sign() <= 0 {
|
||||
return fmt.Errorf("check: array length %q is not positive", aLen.Str(q.tm))
|
||||
}
|
||||
fallthrough
|
||||
|
||||
|
||||
Reference in new issue
Block a user