Segmentation fault with mpz_inp_raw on gcc45

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

       Dear Torbjörn,

>   $ cat
>   -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.


More information about the gmp-bugs mailing list