summaryrefslogtreecommitdiff
path: root/src/vasprintf.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-07-16 14:17:55 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-07-16 14:17:55 +0000
commit28413d17f5ef3362a7fc7796f7a39572c3d49aab (patch)
tree4c7771a9e586a7eb094ae4d99ac4331015428123 /src/vasprintf.c
parent2939fc5abe3ffceff86f6de9e495bd5eba83f3ec (diff)
downloadmpfr-28413d17f5ef3362a7fc7796f7a39572c3d49aab.tar.gz
[src/vasprintf.c] Added 2 FIXME and removed an incorrect MPFR_ASSERTN
(which came from r5236). git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@12933 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/vasprintf.c')
-rw-r--r--src/vasprintf.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/vasprintf.c b/src/vasprintf.c
index 8f2a51432..24f70cc6d 100644
--- a/src/vasprintf.c
+++ b/src/vasprintf.c
@@ -102,7 +102,12 @@ static const char num_to_text[] = "0123456789abcdef";
/* some macro and functions for parsing format string */
-/* Read an integer; saturate to INT_MAX. */
+/* Read an integer. An overflow is possible only with no indirection,
+ in which case the integer is non-negative; saturate to INT_MAX.
+ FIXME: saturating is not the correct behavior. Add a width_overflow
+ field to specinfo? (This may be needed as for %n, the width must be
+ ignored, and an overflow on this field has no consequences.)
+ */
#define READ_INT(ap, format, specinfo, field, label_out) \
do { \
while (*(format)) \
@@ -2052,8 +2057,9 @@ mpfr_vasnprintf_aux (char **ptr, char *Buf, size_t size, const char *fmt,
if (spec.width < 0)
{
spec.left = 1;
+ /* FIXME: This is buggy on INT_MIN (undefined behavior). But first,
+ decide what to do with READ_INT (see the other FIXME). */
spec.width = -spec.width;
- MPFR_ASSERTN (spec.width < INT_MAX);
}
if (*fmt == '.')
{