aboutsummaryrefslogtreecommitdiffstats
path: root/sysparser
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2016-09-19 16:44:33 +0200
committerAndrey Konovalov <andreyknvl@google.com>2016-09-19 16:44:33 +0200
commit48818aa114afca38b61787e215bbec44f8421a9a (patch)
tree2853e57895e1bf0ace5fb341a9a072a64b8416fa /sysparser
parent551c2aa7e421a329397f97aff5fb7be9a76f4398 (diff)
sysparser: disallow unions with only one field
Diffstat (limited to 'sysparser')
-rw-r--r--sysparser/lexer.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/sysparser/lexer.go b/sysparser/lexer.go
index 26a21e57a..21c7b77ef 100644
--- a/sysparser/lexer.go
+++ b/sysparser/lexer.go
@@ -86,6 +86,9 @@ func Parse(in io.Reader) *Description {
}
}
}
+ if str.IsUnion && len(str.Flds) <= 1 {
+ failf("union %v has only %v fields, need at least 2", str.Name, len(str.Flds))
+ }
structs[str.Name] = *str
str = nil
} else {