From nobody  Tue Dec 29 05:36:01 1998
Received: (from nobody@localhost)
          by hub.freebsd.org (8.8.8/8.8.8) id FAA00418;
          Tue, 29 Dec 1998 05:36:01 -0800 (PST)
          (envelope-from nobody)
Message-Id: <199812291336.FAA00418@hub.freebsd.org>
Date: Tue, 29 Dec 1998 05:36:01 -0800 (PST)
From: schmr000@mail.uni-mainz.de
To: freebsd-gnats-submit@freebsd.org
Subject: gmp's mpq_add and mpq_sub are buggy
X-Send-Pr-Version: www-1.0

>Number:         9233
>Category:       bin
>Synopsis:       gmp's mpq_add and mpq_sub are buggy
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 29 05:40:00 PST 1998
>Closed-Date:    Sun Feb 17 16:48:11 UTC 2008
>Last-Modified:  Sun Feb 17 16:48:11 UTC 2008
>Originator:     Ralf Schmitt
>Release:        3.0
>Organization:
>Environment:
FreeBSD myname.my.domain 3.0-RELEASE FreeBSD 3.0-RELEASE #1: Tue Dec 22 
>Description:
A bug in mpq_add and mpq_sub makes them work unreliably due to 
references outside of allocated memory (quoted from the GNU MP web pages)
>How-To-Repeat:
Compile and run the following program:

#include <iostream.h>
#include <gmp.h>
 
void setRational(mpq_t &rat, const char *num, const char *den)
{
        mpz_t tmp;
        mpz_init(tmp);
        
        mpz_set_str(tmp, num, 10);
        mpq_set_num(rat, tmp);
        
        mpz_set_str(tmp, den, 10);
        mpq_set_den(rat, tmp);
        
        
        mpz_clear(tmp);
}
 
void test()
{
        mpq_t r1,r2, result;
 
        mpq_init(r1);
        mpq_init(r2);
        mpq_init(result);
 
 
        setRational(r1,"1999999999999999999","10000000000000000000000000000000000");
        setRational(r2, "-1","100000000");
 
        cout << "Calling mpq_sub" << endl;
        mpq_sub(result, r1, r2);
        
}
 
int main()
{
        test();
}

>Fix:
Apply the diffs from the GNU MP web pages:
http://www.matematik.su.se/~tege/gmp
>Release-Note:
>Audit-Trail:

From: Giorgos Keramidas <charon@labs.gr>
To: freebsd-gnats-submit@FreeBSD.org, schmr000@mail.uni-mainz.de
Cc:  
Subject: Re: bin/9233: gmp's mpq_add and mpq_sub are buggy
Date: Thu, 14 Jun 2001 06:25:48 +0300

 I did a bit of research on this.
 Tested it on 4-STABLE, and it still crashes in mpq_sub().
 
 The version of libgmp included in 4-STABLE is 2.0.2 :/
 A quick search in the bug-gmp mailing list archives
 shows no replies on the thread linked below
 
 http://www.geocrawler.com/mail/thread.php3?subject=bug+in+gmp+version+2.0.2&list=367
 
 Will try to test a newer version of libgmp, and see if
 the bug still persists.
 
 I have already contacted markm@freebsd.org about it,
 since he's the one who imported the version of libgmp
 that we currently have in 4-STABLE.
 
 -giorgos
State-Changed-From-To: open->suspended 
State-Changed-By: kris 
State-Changed-When: Sat Jul 12 22:44:04 PDT 2003 
State-Changed-Why:  
This is unlikely to be fixed since libgmp was removed from 
the 5.0 branch.  I recommend you use the libgmp port instead. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=9233 
State-Changed-From-To: suspended->closed 
State-Changed-By: antoine 
State-Changed-When: Sun Feb 17 16:46:52 UTC 2008 
State-Changed-Why:  
Close: there is no more libgmp in RELENG_[567]. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=9233 
>Unformatted:
