curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Found infinite looping in libCurl version 7.55.1

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
Date: Mon, 20 Jan 2020 23:10:36 +0100 (CET)

On Mon, 20 Jan 2020, Uma Shunmugan via curl-library wrote:

> It might not be a coincidence, but when this occurred, I noticed that a time
> value (timeval) returned by GetTickCount() and set in the "key" for some
> node in the Curl_tree passed into Curl_splay() had just wrapped around (due
> to the 49.7 days limitation). Is this a known issue, or is it possible that
> this could have caused Curl_splay() to get stuck in a loop?

It is not a known issue but having the time wrap and start over at zero sounds
like something that could be problematic.

> If so, is there a fix for it?

Current libcurl doesn't use GetTickCount() if you run on Vista or later so it
should already be avoided. For older systems there's no fix as far as I can
see.

> And is there any test program that I could run against libcurl to reproduce
> this infinite loop issue?

Not to my knowledge.

> BTW, I see in the libCurl changlog that high resolution timestamps are used
> on Windows starting from version libcurl 7.64.0. Was this change done to
> avoid similar issues as the one I have seen?

No.

> Would you recommend me to upgrade to this version?

If you're going to upgrade, I would recommend going to the latest version
while you're at it.

> Now, I've checked timeval.c in 7.55.1, and realized that GetTickcount64()
> would have been used instead, if _WIN32_WINNT and _WIN32_WINNT_VISTA had
> been defined to the correct values. It's not clear to me where/how these
> macros are to be defined, though. Is there a configuration option for these
> in the build? If not, could I simply define these in config-win32.h? FYI,
> I had compiled libcurl on Window 2008 using Visual Studio 2005, and
> obviously these macros were not defined at all.

I don't remember what 7.55.1 did.

> If this issue could not be due to time value rolling over problem, is there
> any other known issues that would explain this infinite looping? What else
> could I do to debug this further?

I'm not aware of any infinite looping bug mentioned in recent years until your
mail here.

To debug it, I would first try hard to reproduce (possibly by writing a mock
version of GetTickCount() for curl). Then when reproduced, see if a current
libcurl is likely to have similar logic that can be tricked in the same or
similar ways.

--
  / daniel.haxx.se | Commercial curl support up to 24x7 is available!
                   | Private help, bug fixes, support, ports, new features
                   | https://www.wolfssl.com/contact/
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2020-01-20