Fixed SEGV in FLANN's LSH index (#2677)

The reason of the error was overflow in standard types.