Skip to content

Commit

Permalink
switch back to len(min of parts); avoids OOB array access
Browse files Browse the repository at this point in the history
  • Loading branch information
rickeylev committed Nov 25, 2024
1 parent 2b362aa commit 4720a07
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion python/private/py_executable_bazel.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@ def relative_path(from_, to):
to_parts = to.split("/")

# Strip common leading parts from both paths
for _ in range(len(to)):
n = min(len(from_parts), len(to_parts))
for _ in range(n):
if from_parts[0] == to_parts[0]:
from_parts.pop(0)
to_parts.pop(0)
Expand Down

0 comments on commit 4720a07

Please sign in to comment.