Each time I see an implementation of binary search like this I can't help but recall:
https://ai.googleblog.com/2006/06/extra-extra-read-all-about...
Which reminds me just how young the field of computer science is and how even the ^well known^, fundamental algorithms might have buggy implementations.