Skip to content

Commit

Permalink
warn for invalid ^-rules
Browse files Browse the repository at this point in the history
  • Loading branch information
black-sliver committed Jan 6, 2024
1 parent 0930a28 commit 676245d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/core/tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,8 +698,15 @@ AccessibilityLevel Tracker::isReachable(const std::list< std::list<std::string>
}
// '^$func' gives direct accessibility level rather than an integer code count
bool isAccessibilitLevel = s[0] == '^'; // use value as level instead of count
if (isAccessibilitLevel)
if (isAccessibilitLevel) {
if (s.length() < 3 || s[1] != '$') { // only ^$ supported
fprintf(stderr, "Warning: invalid rule \"^%s\"",
sanitize_print(s).c_str());
reachable = AccessibilityLevel::NONE;
break;
}
s = s.substr(1);
}
// check cache for '@' rules
auto it = _reachableCache.find(s);
if (it != _reachableCache.end()) {
Expand Down

0 comments on commit 676245d

Please sign in to comment.