From 7e75143f88ee46069a4fa0dd659ca059c806464e Mon Sep 17 00:00:00 2001 From: Stefan Kempf Date: Sun, 25 Nov 2007 10:27:36 +0000 Subject: Pull from master repo: Complain about invalid bit-field size for unnamed bit-fields as well. ok ragge@ --- usr.bin/pcc/ccom/cgram.y | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'usr.bin') 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, $0); } | declarator ':' con_e { -- cgit v1.2.3