crash on __gmpz_init

Vincent Lefevre vincent at vinc17.net
Mon Jan 22 15:01:24 CET 2024


On 2024-01-22 14:34:21 +0100, Torbjorn Granlund wrote:
> Note that there are several typos for the dimensions in the examples, so
> making sense of things is pretty hard.

Indeed,

      mpz_init( M[ lin*LINES +col] );

should be lin*COLS + col.

I suspect a buffer overflow due to that (the allocated memory
is too small).

I'm just surprised that GCC doesn't emit any warning
(even with -O2 -Wall -Wextra), as some pointers are obviously
incorrect.

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the gmp-bugs mailing list