[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151004002405.GA26016@bolet.org>
Date: Sun, 4 Oct 2015 02:24:05 +0200
From: Thomas Pornin <pornin@...et.org>
To: discussions@...sword-hashing.net
Subject: Re: [PHC] Specification of a modular crypt format (2)
On Sun, Oct 04, 2015 at 03:07:07AM +0300, Alexander Cherepanov wrote:
> but if value > INT_MAX / 10 the result of multiplication is "not in
> the range of representable values for its type". This is an
> undefined behavior and the result of the whole program run is
> undefined (nasal demons et al.).
As an added information, consider that clang and gcc can be invoked
with the "-ftrapv" command-line option; with that option, the generated
code specifically checks for overflows on signed integers (for
additions, subtractions and multiplications, says the gcc
documentation). When an overflow occurs, a trap is triggered (on x86,
this uses the 'ud2' pseudo-opcode).
I don't think that flag is much used in deployed software, but it can be
convenient for testing.
--Thomas Pornin
Powered by blists - more mailing lists