summaryrefslogtreecommitdiffstats
path: root/tools/diagtool/TreeView.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/diagtool/TreeView.cpp')
-rw-r--r--tools/diagtool/TreeView.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/diagtool/TreeView.cpp b/tools/diagtool/TreeView.cpp
index 6298179..fd548ef 100644
--- a/tools/diagtool/TreeView.cpp
+++ b/tools/diagtool/TreeView.cpp
@@ -94,9 +94,13 @@ static int showGroup(llvm::raw_ostream &out, StringRef RootGroup,
bool FlagsOnly) {
ArrayRef<GroupRecord> AllGroups = getDiagnosticGroups();
- GroupRecord Key = { RootGroup.size(), RootGroup.data(), 0, 0 };
+ if (RootGroup.size() > UINT16_MAX) {
+ llvm::errs() << "No such diagnostic group exists\n";
+ return 1;
+ }
+
const GroupRecord *Found =
- std::lower_bound(AllGroups.begin(), AllGroups.end(), Key);
+ std::lower_bound(AllGroups.begin(), AllGroups.end(), RootGroup);
if (Found == AllGroups.end() || Found->getName() != RootGroup) {
llvm::errs() << "No such diagnostic group exists\n";
OpenPOWER on IntegriCloud