Date: Tue, 29 Dec 1998 05:36:01 -0800 (PST) From: schmr000@mail.uni-mainz.de To: freebsd-gnats-submit@FreeBSD.ORG Subject: bin/9233: gmp's mpq_add and mpq_sub are buggy Message-ID: <199812291336.FAA00418@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Dec 29 05:40:00 PST 1998 >Last-Modified: >Originator: Ralf Schmitt >Organization: >Release: 3.0 >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 >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199812291336.FAA00418>