Segmentation fault with mpz_inp_raw on gcc45

Paul Zimmermann Paul.Zimmermann at inria.fr
Wed Sep 15 13:41:15 UTC 2021


       Dear Torbjörn,

>   $ cat test_dummy2.save
>   -e
> 
>   # this is a comment line and should be ignored
> 
> You do understand that mpz_inp_raw expects a binary file with a size
> field followed by that many byytes of data, don't you?
> 
> The file contents above make no sense.

the documentation says:

 -- Function: size_t mpz_inp_raw (mpz_t ROP, FILE *STREAM)
     Input from stdio stream STREAM in the format written by
     'mpz_out_raw', and put the result in ROP.  Return the number of
     bytes read, or if an error occurred, return 0.

I was thus expecting it to return 0 in case of an invalid file.

Paul


More information about the gmp-bugs mailing list