Issue #7406: Fix some occurrences of potential signed overflow in int