Re: signed integer overflow ipow() bash/expr.c:954:12

Chet Ramey <[email protected]>
Newsgroups gmane.comp.shells.bash.bugs
Organization ITS, Case Western Reserve University
Message-ID <[email protected]>
On 12/19/25 6:45 PM, anushakov--- via Bug reports for the GNU Bourne Again 
SHell wrote:

>     Expected Behaviour
>     Any messages without ubsan ERROR.
> 
>     Actual Behaviour
> 
>     expr.c:954:12: runtime error: signed integer overflow: 4294967296 *
>     4294967296 cannot be represented in type 'intmax_t' (aka 'long')
>         #0 0x617b39d06378 in ipow /upstream/bash/expr.c:954:12

Bash expression evaluation performs integer arithmetic without checking for
overflow. It's documented.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    [email protected]    http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc (application/pgp-signature, 203 B)
-----BEGIN PGP SIGNATURE-----

wmMEABEIACMWIQR8ATX7CIqvbGbGULm7WGnwZOp0qwUCaUld0wUDAAAAAAAKCRC7WGnwZOp0q6fV
AJoD/ZSCszdNDHM/QDOZjMcb0Y/vigCeLivNIW0l89CzNEyGBZWFsG5xrcg=
=Yp3A
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.