summaryrefslogtreecommitdiff
path: root/struct.c
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-07-05 10:01:06 -0700
committerJeremy Evans <code@jeremyevans.net>2019-08-29 08:17:43 -0700
commite51dca2596db9567bd4d698b18b4d300575d3881 (patch)
treef04771880ddb471d34ed063d90fa04619f945571 /struct.c
parent01b723ba6dd48a0954765e43cff6bd9212afe259 (diff)
Disallow use of attrset symbols as Struct members
Fixes [Bug #11326]
Diffstat (limited to 'struct.c')
-rw-r--r--struct.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/struct.c b/struct.c
index 4ebf6aa3fa..7a78b4946f 100644
--- a/struct.c
+++ b/struct.c
@@ -551,6 +551,9 @@ rb_struct_s_def(int argc, VALUE *argv, VALUE klass)
tbl = RHASH_TBL(rest);
for (i=0; i<argc; i++) {
VALUE mem = rb_to_symbol(argv[i]);
+ if (rb_is_attrset_sym(mem)) {
+ rb_raise(rb_eArgError, "invalid struct member: %"PRIsVALUE, mem);
+ }
if (st_insert(tbl, mem, Qtrue)) {
rb_raise(rb_eArgError, "duplicate member: %"PRIsVALUE, mem);
}