bits unused constraint failure


git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@1276 59561ff5-6e30-0410-9f3c-9617f08c8826
diff --git a/skeletons/BIT_STRING.c b/skeletons/BIT_STRING.c
index 8acea86..9b98271 100644
--- a/skeletons/BIT_STRING.c
+++ b/skeletons/BIT_STRING.c
@@ -50,7 +50,8 @@
 	const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
 
 	if(st && st->buf) {
-		if(st->size == 1 && st->bits_unused) {
+		if((st->size == 0 && st->bits_unused)
+		|| st->bits_unused < 0 || st->bits_unused > 7) {
 			_ASN_CTFAIL(app_key, td, sptr,
 				"%s: invalid padding byte (%s:%d)",
 				td->name, __FILE__, __LINE__);