summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorStefan Kempf <stefan@cvs.openbsd.org>2007-11-25 10:27:36 +0000
committerStefan Kempf <stefan@cvs.openbsd.org>2007-11-25 10:27:36 +0000
commit7e75143f88ee46069a4fa0dd659ca059c806464e (patch)
treefcd24b972c9f2aede0ddef219493a9505299d554 /usr.bin
parentfc98762f8c1169c3599ecbf5fe96fe10a507c9be (diff)
Pull from master repo:
Complain about invalid bit-field size for unnamed bit-fields as well. ok ragge@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/pcc/ccom/cgram.y6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/pcc/ccom/cgram.y b/usr.bin/pcc/ccom/cgram.y
index 7cec014fb61..b914b1c4612 100644
--- a/usr.bin/pcc/ccom/cgram.y
+++ b/usr.bin/pcc/ccom/cgram.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgram.y,v 1.6 2007/11/22 15:06:43 stefan Exp $ */
+/* $OpenBSD: cgram.y,v 1.7 2007/11/25 10:27:35 stefan Exp $ */
/*
* Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se).
@@ -562,6 +562,10 @@ struct_declarator: declarator {
| ':' con_e {
if (!(instruct&INSTRUCT))
uerror( "field outside of structure" );
+ if ($2 < 0 || $2 >= FIELD) {
+ uerror("illegal field size");
+ $2 = 1;
+ }
falloc(NULL, $2, -1, $<nodep>0);
}
| declarator ':' con_e {