Segmentation fault with mpz_inp_raw on gcc45

Vincent Lefevre vincent at vinc17.net
Wed Sep 15 14:42:29 UTC 2021


On 2021-09-15 16:13:55 +0200, Torbjorn Granlund wrote:
> I tried to reproduce this on several systems.  I failed; mpz_inp_raw
> returns 0 for me as it should.
> 
> I cannot be sure I got test_dummy2.save right.  I did include the line
> that asked to be ignored.  Should I have ignored it?  I added LF at each
> appparent line end, including the ignore line.

You may need a bigger file, as shown by strace output:

openat(AT_FDCWD, "test_dummy2.save", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=51, ...}) = 0
read(3, "-e\n\n# this is a comment line and"..., 4096) = 51
mmap(NULL, 761597952, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f267cd4a000
read(3, "", 761593856)                  = 0

i.e. if there is any issue in GMP, the test_dummy2.save file is too
small as nothing is read from read(3, "", 761593856).

Paul should give more details.

-- 
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