[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gmp-bugs
Subject:    bug in mpz_urandomm
From:       tg () swox ! com (Torbjorn Granlund)
Date:       2009-03-12 18:57:57
Message-ID: 86fxhipo0a.fsf () shell ! gmplib ! org
[Download RAW message or body]

Pierrick Gaudry <pierrick.gaudry at gmail.com> writes:

  Section 3.4 of the manual says:
    " GMP lets you use the same variable for both input and output in one
    call."
    
  And in Section 5.13, there is no exception for mpz_urandomm(). However
  the implementation (in 4.2.4, at least), does not allow the first
  parameter (the result) to be the third one (the bound). See for instance
  the line 72 of mpz/urandomm.c that compares n and rp, but n can be
  clobbered just the line before, if it's an alias to rp.
  
  So I think this is a bug in the code, or in the documentation (I have no
  objection to mpz_urandomm() not allowing aliases, but this should be
  mentioned).
  
Thanks for this bug report!

I will fix the code, since an arbitrary exception to the overlap rule
would be somewhat unhelpful, I think.

(I thought mopz/reuse.c tested all functions for this, but apparently it
does not.  I'll fix that too.)

-- 
Torbj?rn

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic