Fix an overflow bug with Search.

INT_MIN and INT_MAX are dangerous to use.