diff --git a/coreutils-i18n.patch b/coreutils-i18n.patch index fbdf9ba..f8d7070 100644 --- a/coreutils-i18n.patch +++ b/coreutils-i18n.patch @@ -7,7 +7,8 @@ src/sort.c | 743 +++++++++++++++++++++++++++++++++++++++++--- src/unexpand.c | 228 +++++++++++++ src/uniq.c | 265 +++++++++++++++ - tests/local.mk | 1 + tests/i18n/sort.sh | 29 + + tests/local.mk | 2 tests/misc/cut.pl | 7 tests/misc/expand.pl | 40 ++ tests/misc/fold.pl | 50 ++ @@ -18,7 +19,7 @@ tests/misc/unexpand.pl | 39 ++ tests/misc/uniq.pl | 55 +++ tests/pr/pr-tests.pl | 49 ++ - 20 files changed, 3194 insertions(+), 180 deletions(-) + 21 files changed, 3224 insertions(+), 180 deletions(-) Index: lib/linebuffer.h =================================================================== @@ -3261,8 +3262,8 @@ Index: src/sort.c + + if (ignore || translate) + { -+ char *copy_a = (char *) xmalloc((lena + lenb) * MB_CUR_MAX + 2); -+ char *copy_b = copy_a + (lena * MB_CUR_MAX) + 1; ++ char *copy_a = (char *) xmalloc((lena + lenb) * MB_LEN_MAX + 2); ++ char *copy_b = copy_a + (lena * MB_LEN_MAX) + 1; + size_t new_len_a, new_len_b; + size_t i, j; + @@ -4112,6 +4113,14 @@ Index: tests/local.mk tests/misc/sort-merge.pl \ tests/misc/sort-merge-fdlimit.sh \ tests/misc/sort-month.sh \ +@@ -516,6 +517,7 @@ all_tests = \ + tests/du/threshold.sh \ + tests/du/trailing-slash.sh \ + tests/du/two-args.sh \ ++ tests/i18n/sort.sh \ + tests/id/gnu-zero-uids.sh \ + tests/id/no-context.sh \ + tests/id/context.sh \ Index: tests/misc/cut.pl =================================================================== --- tests/misc/cut.pl.orig @@ -4718,3 +4727,37 @@ Index: tests/pr/pr-tests.pl my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE}; +Index: tests/i18n/sort.sh +=================================================================== +--- /dev/null ++++ tests/i18n/sort.sh +@@ -0,0 +1,29 @@ ++#!/bin/sh ++# Verify sort's multi-byte support. ++ ++. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src ++print_ver_ sort ++ ++export LC_ALL=en_US.UTF-8 ++locale -k LC_CTYPE | grep -q "charmap.*UTF-8" \ ++ || skip_ "No UTF-8 locale available" ++ ++# Enable heap consistency checkng on older systems ++export MALLOC_CHECK_=2 ++ ++ ++# check buffer overflow issue due to ++# expanding multi-byte representation due to case conversion ++# https://bugzilla.suse.com/show_bug.cgi?id=928749 ++cat < exp ++. ++ɑ ++EOF ++cat < out || fail=1 ++. ++ɑ ++EOF ++compare exp out || { fail=1; cat out; } ++ ++ ++Exit $fail diff --git a/coreutils-tests-shorten-extreme-factor-tests.patch b/coreutils-tests-shorten-extreme-factor-tests.patch index 8e15c09..aaef1b1 100644 --- a/coreutils-tests-shorten-extreme-factor-tests.patch +++ b/coreutils-tests-shorten-extreme-factor-tests.patch @@ -16,7 +16,7 @@ Index: tests/local.mk =================================================================== --- tests/local.mk.orig +++ tests/local.mk -@@ -661,14 +661,9 @@ all_tests = \ +@@ -662,14 +662,9 @@ all_tests = \ # See tests/factor/create-test.sh. tf = tests/factor factor_tests = \ diff --git a/coreutils-testsuite.changes b/coreutils-testsuite.changes index 017af61..a30bb11 100644 --- a/coreutils-testsuite.changes +++ b/coreutils-testsuite.changes @@ -8,9 +8,11 @@ Tue May 12 09:32:53 UTC 2015 - mail@bernhard-voelker.de Tue May 12 08:56:13 UTC 2015 - mail@bernhard-voelker.de - Fix memory handling error with case insensitive sort using UTF-8 - (boo#928749): - * coreutils-i18n.patch: Allocate more memory as the upper form of - some multi-byte characters may be 1 byte wider. + (boo#928749): coreutils-i18n.patch + src/sort.c (keycompare_mb): Ensure the buffer is big enough + to handle anything output from wctomb(). Theoretically any + input char could be converted to multiple output chars, + and so we need to multiply the storage by MB_LEN_MAX. ------------------------------------------------------------------- Tue Apr 7 18:18:31 UTC 2015 - crrodriguez@opensuse.org diff --git a/coreutils.changes b/coreutils.changes index 017af61..a30bb11 100644 --- a/coreutils.changes +++ b/coreutils.changes @@ -8,9 +8,11 @@ Tue May 12 09:32:53 UTC 2015 - mail@bernhard-voelker.de Tue May 12 08:56:13 UTC 2015 - mail@bernhard-voelker.de - Fix memory handling error with case insensitive sort using UTF-8 - (boo#928749): - * coreutils-i18n.patch: Allocate more memory as the upper form of - some multi-byte characters may be 1 byte wider. + (boo#928749): coreutils-i18n.patch + src/sort.c (keycompare_mb): Ensure the buffer is big enough + to handle anything output from wctomb(). Theoretically any + input char could be converted to multiple output chars, + and so we need to multiply the storage by MB_LEN_MAX. ------------------------------------------------------------------- Tue Apr 7 18:18:31 UTC 2015 - crrodriguez@opensuse.org