vasnprintf: Fix -Wshadow=local warnings

2025-04-26 Thread Bruno Haible via Gnulib discussion list
ion of 'i' shadows a previous local ../../gllib/vasnprintf.c:6183:57: warning: declaration of 'i' shadows a previous local 2025-04-26 Bruno Haible vasnprintf: Fix -Wshadow=local warnings. * lib/vasnprintf.c (VASNPRINTF): Rename local variable 'i&#

vasnprintf: Fix memory size bound for %g with grouping and precision

2025-04-11 Thread Bruno Haible via Gnulib discussion list
patch fixes it. 2025-04-11 Bruno Haible vasnprintf: Fix memory size bound for %g with grouping and precision. * lib/vasnprintf.c (MAX_ROOM_NEEDED): For %g, consider also the size of the thousands separators. diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c index a07c137

vasnprintf: Fix handling of # flag in %b, %B directives

2025-04-10 Thread Bruno Haible via Gnulib discussion list
27; failed Aborted (core dumped) This patch fixes it. 2025-04-10 Bruno Haible vasnprintf: Fix handling of # flag in %b, %B directives. * lib/vasnprintf.c (VASNPRINTF): In the prec_ourselves code, treat a 0b prefix like a 0x prefix. diff --git a/lib/vasnprintf.c b/li

Re: c-vasnprintf: Fix link errors

2024-06-25 Thread Collin Funk
Bruno Haible writes: > These two patches fix the bug and add the unit test. Will push once savannah > is up again. Seems to be up now. I think it was down since last night/early this morning so I couldn't pull any of your previous patches either. Collin

c-vasnprintf: Fix link errors

2024-06-25 Thread Bruno Haible
5 Bruno Haible c-vasnprintf: Fix link errors. * modules/c-vasnprintf (configure.ac): Ensure printf-args.c and printf-parse.c get compiled. Invoke gl_PREREQ_PRINTF_ARGS, gl_PREREQ_PRINTF_PARSE. >From 82791096e9320f4fbf0390f7fa7e06e49b4c9672 Mon Sep 17 00:00:00 2001

u*-vasnprintf: Fix handling of %ls, %lc directives on Solaris, MSVC

2024-06-18 Thread Bruno Haible
t_function): Likewise. * tests/unistdio/test-ulc-vasnprintf3.c (test_function): Likewise. u*-vasnprintf: Fix handling of %ls, %lc directives on Solaris, MSVC. * lib/vasnprintf.c (VASNPRINTF): When implementing the %ls, %lc directives ourselves: Rename variable '

unistdio/u*-vasnprintf: Fix conversion of %Id directive result

2023-03-21 Thread Bruno Haible
aible unistdio/u*-vasnprintf: Fix conversion of %Id directive result. * lib/vasnprintf.c (VASNPRINTF): Don't assume that snprintf's result is entirely ASCII if the directive contain the glibc 'I' flag. diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c index bd13002e98..8e

Re: [PATCH] vasnprintf: fix potential use after free

2014-12-08 Thread Paul Eggert
On 12/08/2014 07:24 AM, Eric Blake wrote: It might make sense to have a variant of 'free' that preserves errno, >but we should probably give the variant a different name. 'noerr_free', >say. I'm not sure a variant is needed; if we can get glibc to guarantee the POSIX proposal now, then we would

Re: [PATCH] vasnprintf: fix potential use after free

2014-12-08 Thread Eric Blake
On 12/07/2014 07:29 PM, Paul Eggert wrote: > Pádraig Brady wrote: >> BTW if free() may reset errno on some platforms then it's >> probably worth augmenting the gnulib free() wrapper >> to restore errno if needed, > > The documented GNU behavior for 'free' allows 'free' to set errno, > right? So w

Re: [PATCH] vasnprintf: fix potential use after free

2014-12-08 Thread Pádraig Brady
ble to take advantage of portably. Hence I pushed the attached to address this. thanks, Pádraig. From ec6a60bfd9ba0f12ec07809636891909ee7ded66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Mon, 8 Dec 2014 09:46:38 + Subject: [PATCH] vasnprintf: fix potential incorrect e

Re: [PATCH] vasnprintf: fix potential use after free

2014-12-07 Thread Paul Eggert
Pádraig Brady wrote: BTW if free() may reset errno on some platforms then it's probably worth augmenting the gnulib free() wrapper to restore errno if needed, The documented GNU behavior for 'free' allows 'free' to set errno, right? So why should the corresponding gnulib wrapper guarantee beh

Re: [PATCH] vasnprintf: fix potential use after free

2014-12-06 Thread Pádraig Brady
On 06/12/14 16:06, Pádraig Brady wrote: > On 06/12/14 02:46, Eric Blake wrote: >> On 12/05/2014 06:23 PM, Pádraig Brady wrote: >>> * lib/vasnprintf.c (VASNPRINTF): Fix free-memory read, >>> flagged by clang-analyzer 3.4.2. >>> --- >>> ChangeLo

Re: [PATCH] vasnprintf: fix potential use after free

2014-12-06 Thread Pádraig Brady
On 06/12/14 02:46, Eric Blake wrote: > On 12/05/2014 06:23 PM, Pádraig Brady wrote: >> * lib/vasnprintf.c (VASNPRINTF): Fix free-memory read, >> flagged by clang-analyzer 3.4.2. >> --- >> ChangeLog| 6 ++ >> lib/vasnprintf.c | 2 +- >> 2 fil

Re: [PATCH] vasnprintf: fix potential use after free

2014-12-05 Thread Eric Blake
On 12/05/2014 06:23 PM, Pádraig Brady wrote: > * lib/vasnprintf.c (VASNPRINTF): Fix free-memory read, > flagged by clang-analyzer 3.4.2. > --- > ChangeLog| 6 ++ > lib/vasnprintf.c | 2 +- > 2 files changed, 7 insertions(+), 1 deletion(-) > > +++ b/lib/va

[PATCH] vasnprintf: fix potential use after free

2014-12-05 Thread Pádraig Brady
* lib/vasnprintf.c (VASNPRINTF): Fix free-memory read, flagged by clang-analyzer 3.4.2. --- ChangeLog| 6 ++ lib/vasnprintf.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1c4a7ab..41207ea 100644 --- a/ChangeLog +++ b/ChangeLog

vasnprintf: fix comments

2011-10-15 Thread Bruno Haible
A comment was wrong. 2011-10-15 Bruno Haible vasnprintf: Fix comments. * lib/vasnprintf.c (decode_long_double, decode_double): Fix comments. --- lib/vasnprintf.c.orig Sat Oct 15 12:12:49 2011 +++ lib/vasnprintf.cSat Oct 15 12:12:46 2011 @@ -885,9 +885,9 @@ y

vasnprintf: fix syntax errors

2010-05-09 Thread Bruno Haible
This fixes two syntax errors in the libintl build, inside gettext: 2010-05-09 Bruno Haible vasnprintf: Fix syntax errors in libintl build on mingw. * lib/vasnprintf.c (VASNPRINTF): Move a closing brace. Undefine pad_ourselves and prec_ourselves after use. --- lib

vasnprintf: fix buffer overrun

2008-03-30 Thread Bruno Haible
This fixes a buffer overrun on OSF/1 4.0 and Solaris 2.5. Nothing to worry about for the majority of the platforms. 2008-03-30 Bruno Haible <[EMAIL PROTECTED]> Fix buffer overrun. * lib/vasnprintf.c (VASNPRINTF): If !USE_SNPRINTF && pad_ourselves: Don't consider the wid

vasnprintf: fix 2007-11-03 fix

2007-11-09 Thread Bruno Haible
The vasnprintf fix from 2007-11-03 has the effect that when a reallocation is needed, the snprintf() result will fit but the test _whether_ the snprintf() result did fit fails, so that another round of reallocation is performed. Inefficient... 2007-11-09 Bruno Haible <[EMAIL PROTEC

Re: vasnprintf fix

2007-11-05 Thread Bruno Haible
Eric Blake wrote: > I have fixed some memory handling bugs that were in newlib at the time > cygwin 1.5.24 was released. They were probably due to the BSD heritage of some parts of newlib? Another question is how to deal with the bug on MacOS X ? This is a widely used platform, and there are seve

Re: vasnprintf fix

2007-11-05 Thread Eric Blake
Bruno Haible clisp.org> writes: > Now that you say it, it's obvious what is going on: the code has first > decided that it doesn't need the 'a'/'A' substitute (since Cygwin already > has it) and then decided that it needs to emulate 'A'/'A' (because Cygwin > either crashes in low-memory situation

Re: vasnprintf fix

2007-11-05 Thread Bruno Haible
Hello Eric, > Something's still fishy. Now I'm getting aborts for test-vasprintf-posix.c > on > cygwin, with the following sequence of instructions in vasnprintf.c: > > Breakpoint 1, test_function (my_asprintf=0x413052 ) > at ../../tests/test-vasprintf-posix.c:173 > 173 int retval =

Re: vasnprintf fix

2007-11-05 Thread Eric Blake
Eric Blake byu.net> writes: > Something's still fishy. Now I'm getting aborts for test-vasprintf-posix.c on > cygwin git bisect narrowed it down to this commit: 7cd87873c8336cb43c0452df4b11238f014be8a1 is first bad commit commit 7cd87873c8336cb43c0452df4b11238f014be8a1 Author: Bruno Haible <

Re: vasnprintf fix

2007-11-05 Thread Eric Blake
Bruno Haible clisp.org> writes: > > The floating-point output code crashed due to an abort() for values with > large exponents (> 1e34 for 'double'). This fixes it. > > 2007-11-04 Bruno Haible clisp.org> > > * lib/vasnprintf.c (scale10_round_decimal_decoded): Fix shift loop. Somethin

vasnprintf fix

2007-11-04 Thread Bruno Haible
The floating-point output code crashed due to an abort() for values with large exponents (> 1e34 for 'double'). This fixes it. 2007-11-04 Bruno Haible <[EMAIL PROTECTED]> * lib/vasnprintf.c (scale10_round_decimal_decoded): Fix shift loop. --- lib/vasnprintf.c.orig 2007-11-04 14:5

vasnprintf: fix overflow detection on OSF/1 5.1

2007-11-03 Thread Bruno Haible
On OSF/1 5.1, the printf() and fprintf() replacements no longer produced output of more than 1999 bytes. Wh... 2007-11-03 Bruno Haible <[EMAIL PROTECTED]> * lib/vasnprintf.c (VASNPRINTF): Don't assume that snprintf's return value is C99 compliant. Needed for OSF/1 5

vasnprintf: fix out-of-memory handling

2007-11-03 Thread Bruno Haible
The out-of-memory handling of gnulib's *printf replacement is broken: it sometimes sets errno to EINVAL instead of ENOMEM. This fixes it. 2007-11-03 Bruno Haible <[EMAIL PROTECTED]> Fix out-of-memory handling of vasnprintf. * lib/printf-parse.c: Include . (PRINTF_PARSE):

vasnprintf: fix includes

2007-03-24 Thread Bruno Haible
This fixes a problem that would only be noticeable on platform without 'long double' support. 2007-03-24 Bruno Haible <[EMAIL PROTECTED]> * lib/vasnprintf.c [!HAVE_LONG_DOUBLE]: Include printf-frexp.h. Don't include isnanl-nolibm.h. *** lib/vasnprintf.c22 Mar 2007 02:04:01

Re: another vasnprintf fix

2007-03-19 Thread Bruno Haible
Eric Blake wrote: > since vasnprintf has the > nice API property that, unlike all other *printf functions, it does not > return an int, it should not need to be limited by INT_MAX; otherwise you > are introducing an artificial limitation You're right; I forgot about this argumentation. My patch co

another vasnprintf fix

2007-03-19 Thread Bruno Haible
Performing the unit tests on NetBSD 3.0 uncovered this: When the "size of given buffer" argument passed to vasnprintf() was > INT_MAX, the function could loop endlessly instead of failing with EOVERFLOW. Note: NetBSD also has a bug here: snprintf() returns -1 with errno = EINVAL, where POSIX says

Re: another vasnprintf fix

2007-03-17 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 3/17/2007 6:32 PM: > * lib/vasnprintf.c (EOVERFLOW): New fallback definition. > (VASNPRINTF): Fail with EOVERFLOW when the given allocated size is > larger than INT_MAX, or when it grow to a value larger t