diff options
author | whitequark <whitequark@whitequark.org> | 2020-05-27 05:20:39 +0000 |
---|---|---|
committer | whitequark <whitequark@whitequark.org> | 2020-05-29 06:43:18 +0000 |
commit | efa7424fb93943d746a344d08e5e879d983709e9 (patch) | |
tree | 32644607450d6bbb1b5412f665d5400a7fd9300d /kernel | |
parent | b6513521931ab7375f5409db7d94140b533b5fa2 (diff) | |
download | yosys-efa7424fb93943d746a344d08e5e879d983709e9.tar.gz yosys-efa7424fb93943d746a344d08e5e879d983709e9.tar.bz2 yosys-efa7424fb93943d746a344d08e5e879d983709e9.zip |
Restrict RTLIL::IdString to not contain whitespace or control chars.
This is an existing invariant (most backends can't cope with these)
but one that was not checked or documented.
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/rtlil.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/rtlil.h b/kernel/rtlil.h index 11c45bbec..898c54a3a 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -150,9 +150,6 @@ namespace RTLIL if (!p[0]) return 0; - log_assert(p[0] == '$' || p[0] == '\\'); - log_assert(p[1] != 0); - auto it = global_id_index_.find((char*)p); if (it != global_id_index_.end()) { #ifndef YOSYS_NO_IDS_REFCNT @@ -165,6 +162,11 @@ namespace RTLIL return it->second; } + log_assert(p[0] == '$' || p[0] == '\\'); + log_assert(p[1] != 0); + for (const char *c = p; *c; c++) + log_assert((unsigned)*c > (unsigned)' '); + #ifndef YOSYS_NO_IDS_REFCNT if (global_free_idx_list_.empty()) { if (global_id_storage_.empty()) { |