Wednesday, May 25, 2011

Re: [BUG] 'non-empty string' >? '' returns false on amd64 arch

Ivan Krasilnikov wrote:

> I confirm the problem. Looks like there's a bug in UTF-8 handling in
> function mb_strnicmp() in mbyte.c, specifically in the following "if"
> which was introduced by patch 7.3.040:
>
> /* Don't case-fold illegal bytes or truncated characters. */
> if (utf_ptr2len(s1 + i) < l || utf_ptr2len(s2 + i) < l)
> return -1;
>
> The check "utf_ptr2len(s2 + i) < l" is wrong.

Yes, this code just returns -1, no matter if the first or second string
is bigger.

Your other remark about difference in byte length of a character is
right, but it's not so easy to fix. Can you suggest a patch?
Preferably with a test.


--
To be rich is not the end, but only a change of worries.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment