summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2015-07-31 12:30:50 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2015-07-31 12:30:50 +0000
commitdda8bdd4a8c4a112c06bf8c0e3960046a11d0ea7 (patch)
treeafe2415f5df7669fa30090870c181d345fea02c1
parentc06f8b4c367ac5dddff6ae40dc43cd5abd0f3a8d (diff)
downloadmpfr-dda8bdd4a8c4a112c06bf8c0e3960046a11d0ea7.tar.gz
[src/fpif.c] Added an assertion (I get a build failure with gcc-snapshot
20150722-1 due to -Werror=array-bounds, but the code looks OK). Simplified test on: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67077 git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@9638 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--src/fpif.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/fpif.c b/src/fpif.c
index da0989967..4b725d1be 100644
--- a/src/fpif.c
+++ b/src/fpif.c
@@ -177,6 +177,8 @@ mpfr_fpif_store_precision (unsigned char *buffer, size_t *buffer_size,
return result;
}
+#define BUFFER_SIZE 8
+
/*
* fh : IN : file handler
* return the precision stored in the binary buffer, 0 in case of error
@@ -186,7 +188,7 @@ mpfr_fpif_read_precision_from_file (FILE *fh)
{
mpfr_prec_t precision;
size_t precision_size;
- unsigned char buffer[8];
+ unsigned char buffer[BUFFER_SIZE];
if (fh == NULL)
return 0;
@@ -199,6 +201,7 @@ mpfr_fpif_read_precision_from_file (FILE *fh)
return precision_size - 7;
precision_size++;
+ MPFR_ASSERTD (precision_size <= BUFFER_SIZE);
/* Read the precision in little-endian format. */
if (fread (buffer, precision_size, 1, fh) != 1)