Browse Source

cmComputeLinkDepends: Avoid unsigned integer rollover

Brad King 1 year ago
parent
commit
80327430ad
1 changed files with 2 additions and 3 deletions
  1. 2 3
      Source/cmComputeLinkDepends.cxx

+ 2 - 3
Source/cmComputeLinkDepends.cxx

@@ -1494,9 +1494,8 @@ void cmComputeLinkDepends::OrderLinkEntries()
   this->ComponentOrderId = n;
   // Run in reverse order so the topological order will preserve the
   // original order where there are no constraints.
-  for (size_t c = n - 1; c != cmComputeComponentGraph::INVALID_COMPONENT;
-       --c) {
-    this->VisitComponent(c);
+  for (size_t c = n; c > 0; --c) {
+    this->VisitComponent(c - 1);
   }
 
   // Display the component graph.