Mercurial > hg > octave-nkf > gnulib-hg
diff lib/mbmemcasecoll.c @ 13721:5cea8d40bf2c
Fix endless loop in mbmemcasecoll.
* lib/mbmemcasecoll.c (apply_towlower): When mbrtowc returns 0, copy 1
byte.
* tests/test-mbmemcasecmp.h (test_ascii): Test embedded NULs.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Wed, 22 Sep 2010 13:34:54 +0200 |
parents | c2cbabec01dd |
children | 97fc9a21a8fb |
line wrap: on
line diff
--- a/lib/mbmemcasecoll.c +++ b/lib/mbmemcasecoll.c @@ -1,5 +1,5 @@ /* Locale-specific case-ignoring memory comparison. - Copyright (C) 2001, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2001, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -61,8 +61,12 @@ break; if (n1 != (size_t)(-1)) { - wint_t wc2 = towlower (wc1); + wint_t wc2; + if (n1 == 0) /* NUL character? */ + n1 = 1; + + wc2 = towlower (wc1); if (wc2 != wc1) { size_t n2;