change assertion failure for invalid multibyte input in sort to less confusing error message(#591352)

This commit is contained in:
Ondřej Vašík 2010-09-20 13:19:42 +02:00
parent c28546fac4
commit a921d1b238
2 changed files with 8 additions and 3 deletions

View File

@ -2932,7 +2932,7 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/src/sort.c
{
size_t lo = 0;
size_t hi = MONTHS_PER_YEAR;
@@ -2062,11 +2390,79 @@ compare_version (char *restrict texta, s
@@ -2062,11 +2390,80 @@ compare_version (char *restrict texta, s
return diff;
}
@ -2969,7 +2969,8 @@ diff -urNp coreutils-8.5-orig/src/sort.c coreutils-8.5/src/sort.c
+ memset (&state, '\0', sizeof(mbstate_t));
+
+ wclength = mbsrtowcs (month_wcs, pp, len + 1, &state);
+ assert (wclength != (size_t)-1 && *pp == NULL);
+ if (wclength == (size_t)-1 || *pp != NULL)
+ error (SORT_FAILURE, 0, _("Invalid multibyte input %s."), quote(s));
+
+ for (i = 0; i < wclength; i++)
+ {

View File

@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.5
Release: 7%{?dist}
Release: 8%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@ -344,6 +344,10 @@ fi
%{_libdir}/coreutils
%changelog
* Mon Sep 20 2010 Ondrej Vasik <ovasik@redhat.com> - 8.5-8
- change assertion failure for invalid multibyte input
in sort to less confusing error message(#591352)
* Wed Sep 09 2010 Ondrej Vasik <ovasik@redhat.com> - 8.5-7
- add RELRO protection to su as well (#630017)