curl-library
Re: Access violation in dprintf_formatf (on 100% progress?)
Date: Sun, 27 Sep 2015 17:56:25 +0200
Guten Tag Thorsten Schöning,
am Sonntag, 27. September 2015 um 16:43 schrieben Sie:
> Guten Tag Daniel Stenberg,
> am Samstag, 26. September 2015 um 23:55 schrieben Sie:
>> Sounds like it is off-by one in reading arguments off the stack so that it got
>> the subsequent number instead of the string it was meant to get. From the
>> fprintf() at lib/progress,c:467.
> This seems to be the right track, I didn't recognized it before but
> the progress output is completely broken if I use the curl versions of
> the *printf functions:
I think I have the root cause now: curlbuild.h chooses __int64 as my
OFF_T, because I have __BORLANDC__ > 0x520. mprintf.c checks for max
integer data type on its own and recognizes HAVE_LONGLONG and some
Visual Studio defines, neither of both was set in my case. So mprintf.c
restricted to long, which is 4 bytes in my case, but the format string
and other numeric data types in the progress function was built with
__int64 in mind. After defining HAVE_LONGLONG the access violation was
gone because va_stack_t used __int64 for the "num" field as well.
While defining HAVE_LONGLONG currently solves my problem best,
curlbuild.h explicitly chooses __int64, so from my point of view the
cleanest solution would be to change mprintf.c to use __int64 in case
of __BORLANDC__ as well, like curlbuild.h does.
Any thoughts?
> Index: mprintf.c
> ===================================================================
> --- mprintf.c (Revision 4088)
> +++ mprintf.c (Arbeitskopie)
> @@ -63,10 +63,12 @@
> # define LONG_LONG_TYPE long long
> # define HAVE_LONG_LONG_TYPE
> #else
> -# if defined(_MSC_VER) && (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64)
> +# if (defined(_MSC_VER) && (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64)) || \
> + (defined(__BORLANDC__) && (__BORLANDC__ >= 0x520))
> # define LONG_LONG_TYPE __int64
> # define HAVE_LONG_LONG_TYPE
> # else
> +#error test
> # undef LONG_LONG_TYPE
> # undef HAVE_LONG_LONG_TYPE
> # endif
Mit freundlichen Grüßen,
Thorsten Schöning
-- Thorsten Schöning E-Mail: Thorsten.Schoening_at_AM-SoFT.de AM-SoFT IT-Systeme http://www.AM-SoFT.de/ Telefon...........05151- 9468- 55 Fax...............05151- 9468- 88 Mobil..............0178-8 9468- 04 AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2015-09-27