[PATCH] Replace division by zero with assert failure

Werner Koch wk at gnupg.org
Fri Nov 8 17:12:43 CET 2013


On Fri,  8 Nov 2013 16:58, phcoder at gmail.com said:
> C specification says that division by zero is undefined and may not
> provoke a signal. So it would be more appropriate to use gcry_assert

Actually this changed some time ago.  What we now do is to call

void
_gcry_divide_by_zero (void)
{
    gpg_err_set_errno (EDOM);
    _gcry_fatal_error (gpg_err_code_from_errno (errno), "divide by zero");
}

I am not sure whether it has or should be backported to 1.5.


Salam-Shalom,

   Werner

-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.




More information about the Gcrypt-devel mailing list