Fix overflow check.

The fixed check assumes positive sizes. The previous check failed when
one of the sizes was 0.