3 ms·
Not just binary search. Anything that involves addition of signed integers could overflow.
by bigbang 17y ago
Not just binary search. Anything that involves addition of signed integers could overflow.
- patio11 17y agoIncluding, as I found to my embarassment recently, my license key generation logic. Turns out that the maximum for a Java integer happens in the middle of the numerical representations of the values that I thought were valid license keys. "Whoops!" (Happily, it turns out that all the keys actually assigned to customers were accepted by the broken version of the checker, too.)