Skip to content

Commit ba46d45

Browse files
committed
Merge branch 'master' of https://github.com/The-OpenROAD-Project-private/OpenSTA into secure-test-suite-cleanup
Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
2 parents cf1db11 + e4338cf commit ba46d45

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

network/ParseBus.cc

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ parseBusName(std::string_view name,
8686
if (brkt_index != std::string_view::npos) {
8787
char brkt_left_ch = brkts_left[brkt_index];
8888
size_t left = name.rfind(brkt_left_ch);
89-
if (left != std::string_view::npos) {
89+
if (left != std::string_view::npos
90+
&& left + 1 < len
91+
&& isdigit(name[left + 1])) {
9092
is_bus = true;
9193
bus_name.append(name.data(), left);
9294
// Simple bus subscript.
@@ -140,19 +142,21 @@ parseBusName(std::string_view name,
140142
if (brkt_index != std::string_view::npos) {
141143
char brkt_left_ch = brkts_left[brkt_index];
142144
size_t left = name.rfind(brkt_left_ch);
143-
if (left != std::string_view::npos) {
145+
if (left != std::string_view::npos
146+
&& left + 1 < len
147+
&& (isdigit(name[left + 1]) || name[left + 1] == '*')) {
144148
is_bus = true;
145149
bus_name.append(name.data(), left);
146-
// Check for bus range.
147-
size_t range = name.find(':', left);
148-
if (range != std::string_view::npos) {
149-
is_range = true;
150-
from = std::stoi(std::string(name.substr(left + 1)));
151-
to = std::stoi(std::string(name.substr(range + 1)));
152-
}
150+
if (name[left + 1] == '*')
151+
subscript_wild = true;
153152
else {
154-
if (left + 1 < len && name[left + 1] == '*')
155-
subscript_wild = true;
153+
// Check for bus range.
154+
size_t range = name.find(':', left);
155+
if (range != std::string_view::npos) {
156+
is_range = true;
157+
from = std::stoi(std::string(name.substr(left + 1)));
158+
to = std::stoi(std::string(name.substr(range + 1)));
159+
}
156160
else
157161
from = to = std::stoi(std::string(name.substr(left + 1)));
158162
}

0 commit comments

Comments
 (0)