Fix UB: Make read_int() follow SEI CERT INT13-C and INT34-C.