fix segfaults in join (i18n patch) when using multibyte locales(#497368)

This commit is contained in:
Ondrej Vasik 2009-04-23 17:01:01 +00:00
parent 64938e3ecc
commit 17e0cac955
2 changed files with 11 additions and 7 deletions

View File

@ -433,7 +433,7 @@ diff -urN coreutils-6.12-orig/tests/Makefile.am coreutils-6.12/tests/Makefile.am
+ +
+ memset (&state, 0, sizeof (mbstate_t)); + memset (&state, 0, sizeof (mbstate_t));
+ +
+ if (ptr == lim) + if (ptr >= lim)
+ return; + return;
+ +
+ if (tab != NULL) + if (tab != NULL)
@ -464,7 +464,7 @@ diff -urN coreutils-6.12-orig/tests/Makefile.am coreutils-6.12/tests/Makefile.am
+ } + }
+ } + }
+ +
+ if (sep == lim) + if (sep >= lim)
+ break; + break;
+ +
+ extract_field (line, ptr, sep - ptr); + extract_field (line, ptr, sep - ptr);
@ -505,7 +505,7 @@ diff -urN coreutils-6.12-orig/tests/Makefile.am coreutils-6.12/tests/Makefile.am
+ mblength = (mblength < 1) ? 1 : mblength; + mblength = (mblength < 1) ? 1 : mblength;
+ +
+ sep = ptr + mblength; + sep = ptr + mblength;
+ while (sep != lim) + while (sep < lim)
+ { + {
+ state_bak = state; + state_bak = state;
+ mblength = mbrtowc (&wc, sep, lim - sep + 1, &state); + mblength = mbrtowc (&wc, sep, lim - sep + 1, &state);
@ -524,7 +524,7 @@ diff -urN coreutils-6.12-orig/tests/Makefile.am coreutils-6.12/tests/Makefile.am
+ } + }
+ +
+ extract_field (line, ptr, sep - ptr); + extract_field (line, ptr, sep - ptr);
+ if (sep == lim) + if (sep >= lim)
+ return; + return;
+ +
+ state_bak = state; + state_bak = state;
@ -538,7 +538,7 @@ diff -urN coreutils-6.12-orig/tests/Makefile.am coreutils-6.12/tests/Makefile.am
+ mblength = (mblength < 1) ? 1 : mblength; + mblength = (mblength < 1) ? 1 : mblength;
+ +
+ ptr = sep + mblength; + ptr = sep + mblength;
+ while (ptr != lim) + while (ptr < lim)
+ { + {
+ state_bak = state; + state_bak = state;
+ mblength = mbrtowc (&wc, ptr, lim - ptr + 1, &state); + mblength = mbrtowc (&wc, ptr, lim - ptr + 1, &state);
@ -556,7 +556,7 @@ diff -urN coreutils-6.12-orig/tests/Makefile.am coreutils-6.12/tests/Makefile.am
+ ptr += mblength; + ptr += mblength;
+ } + }
+ } + }
+ while (ptr != lim); + while (ptr < lim);
+ } + }
+ +
+ extract_field (line, ptr, lim - ptr); + extract_field (line, ptr, lim - ptr);

View File

@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils Name: coreutils
Version: 7.2 Version: 7.2
Release: 2%{?dist} Release: 3%{?dist}
License: GPLv3+ License: GPLv3+
Group: System Environment/Base Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/ Url: http://www.gnu.org/software/coreutils/
@ -314,6 +314,10 @@ fi
/sbin/runuser /sbin/runuser
%changelog %changelog
* Thu Apr 23 2009 Ondrej Vasik <ovasik@redhat.com> 7.2-3
- fix segfaults in join (i18n patch) when using multibyte
locales(#497368)
* Fri Apr 17 2009 Ondrej Vasik <ovasik@redhat.com> 7.2-2 * Fri Apr 17 2009 Ondrej Vasik <ovasik@redhat.com> 7.2-2
- make mv xattr support failures silent (as is done for - make mv xattr support failures silent (as is done for
cp -a) - #496142 cp -a) - #496142