Re:How to break everything by fuzz testing
by colatkinson on Monday April 27, 2020 @05:59AM
(#22994431)
Also known as the "Tortoise and Hare Algorithm!"
https://en.wikipedia.org/wiki/Cycle_detection#Floyd's_Tortoi...
If you just want to detect loops, keep a “+1” pointer that you use to increment through the data; also, keep a “+2” pointer that is advanced twice each time your “+1” pointer advances: either your “+2” pointer hits the end, or it becomes equal to your “+1” pointer — in which case you have a loop.