I got a crash in my MSVC-built Wget by "accidentally" mixing
debug and release obj/libs in my build. (libidn in debug-mode
and Wget in release-mode). So the memory returned from
'idn_decode()' in connect.c:

    if (opt.enable_iri && (name = idn_decode ((char *) print)) != NULL)
...
    xfree (name);

triggered a crash; the CRT mem-block layouts are different in
release and debug-modes. The important thing is that IDN should
free it's own memory using idn_free(). This function has been in
there since 2004!

Same problem in host.c too. Here is a patch:

--- a/connect.c       2015-02-05 15:31:22 +0000
+++ b/connect.c    2015-02-05 15:33:27 +0000
@@ -278,7 +278,7 @@
               str = xmalloc (len);
               snprintf (str, len, "%s (%s)", name, print);
               str[len-1] = '\0';
-              xfree (name);
+              idn_free (name);
             }

           logprintf (LOG_VERBOSE, _("Connecting to %s|%s|:%d... "),


--- a/host.c  2015-02-05 15:31:22 +0000
+++ b/host.c       2015-02-03 01:57:33 +0000
@@ -741,7 +741,7 @@
           str = xmalloc (len);
           snprintf (str, len, "%s (%s)", name, host);
           str[len-1] = '\0';
-          xfree (name);
+          idn_free (name);
         }

       logprintf (LOG_VERBOSE, _("Resolving %s... "),


----------

This probably is alien stuff to you Unix folks. You have no
release/debug-modes to take care of (?)

--
--gv


Reply via email to