bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] fix infinite loop in mbmemcasecoll


From: Pádraig Brady
Subject: [PATCH] fix infinite loop in mbmemcasecoll
Date: Wed, 22 Sep 2010 01:05:48 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3

I was testing multi-byte enhancements to coreutils/join with:
LC_ALL=en_US.utf8 join -i <(env printf '1\x00\n') <(env printf '2\x00\n')
and noticed it spun the CPU because of the NUL char.
The attached fixes the issue for me. This function is supposed
to skip over NUL chars like this right?

cheers,
Pádraig.

--- a/lib/mbmemcasecoll.c       2010-01-04 01:10:30.000000000 +0000
+++ b/lib/mbmemcasecoll.c       2010-09-21 23:52:23.000000000 +0000
@@ -61,6 +63,8 @@
         break;
       if (n1 != (size_t)(-1))
         {
+          if (n1 == 0)
+            n1 = 1; /* copy NUL characters.  */
           wint_t wc2 = towlower (wc1);

           if (wc2 != wc1)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]