Skip to content

Commit 77699b5

Browse files
author
ripley
committed
trap formerly silent overflow in fisher.test()
git-svn-id: https://svn.r-project.org/R/trunk@87468 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent b54cbe7 commit 77699b5

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

doc/NEWS.Rd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,10 @@
482482
483483
\item \code{dir.create()} is protected against being passed an
484484
empty string as its \code{path} argument.
485+
486+
\item Silent integer overflow could occur in the
487+
\sQuote{exact} computations for \code{fisher.test()} for
488+
unrealistic inputs: this is now an error.
485489
}
486490
}
487491
}

src/library/stats/src/fexact.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,6 +1444,8 @@ f5xact(double pastp, double tol, int *kval, int *key, int ldkey,
14441444
else if (stp[ipn] > test2)
14451445
ipn = nr[ipn];
14461446
else {
1447+
if (INT_MAX - ifrq[ipn] < ifreq)
1448+
Rf_error("integer overflow in exact computation");
14471449
ifrq[ipn] += ifreq;
14481450
return;
14491451
}

0 commit comments

Comments
 (0)