bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: checking against signed integer overflow


From: Bruno Haible
Subject: Re: checking against signed integer overflow
Date: Mon, 07 Dec 2020 05:18:55 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-193-generic; KDE/5.18.0; x86_64; ; )

Paul Eggert wrote:
> At this point it would be better for integer arithmetic overflow to 
> generate SIGFPE in some way that a signal handler could tell the difference, 
> but 
> this is not a hill I'm prepared to die on and if it requires significantly 
> more 
> runtime library code or extra instructions in the executable I wouldn't 
> bother.

While glibc already documents that SIGFPE could be signalled for integer
overflow, with code FPE_INTOVF_TRAP [1], I don't know how user-space code
could generate such a signal: raise() doesn't take a second argument,
and sigqueue() sets the code to SI_QUEUE, not FPE_INTOVF_TRAP. [2]

Bruno

[1] 
https://www.gnu.org/software/libc/manual/html_node/Program-Error-Signals.html
[2] https://www.kernel.org/doc/man-pages/online/pages/man2/sigqueue.2.html




reply via email to

[Prev in Thread] Current Thread [Next in Thread]