summary refs log tree commit diff
path: root/ripple/fossil
diff options
context:
space:
mode:
authoredef <edef@unfathomable.blue>2022-05-05 00:43:32 +0000
committeredef <edef@unfathomable.blue>2022-05-05 00:46:24 +0000
commit456e0c5745633dd4ee192e16e14723baf9132922 (patch)
tree3cfb98987c68624aac3bb029145348636f0a2269 /ripple/fossil
parentc7d9e9c09a5cc77092c43eef0780e1e8c39076d0 (diff)
ripple/fossil/mount: terminate out-of-bounds Node::find early
Node::find would walk the tree all the way down and to the right if
given an out of bounds index. This doesn't affect the return value
(None), but it does waste some cycles walking down all the way to
the deepest rightmost leaf.

Change-Id: Ic2f72aa96291a25819fc6c3c2f060fe0182a7663
Diffstat (limited to 'ripple/fossil')
-rw-r--r--ripple/fossil/src/bin/mount.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/ripple/fossil/src/bin/mount.rs b/ripple/fossil/src/bin/mount.rs
index f1bcdde..c9c5955 100644
--- a/ripple/fossil/src/bin/mount.rs
+++ b/ripple/fossil/src/bin/mount.rs
@@ -906,7 +906,7 @@ mod memtree {
 					(0, _) => {
 						break Some(root);
 					}
-					(_, Node::Directory(d)) => {
+					(_, Node::Directory(d)) if index <= d.size => {
 						index -= 1;
 						d
 					}