[coreutils/f18] fix possible free memory read and dataloss in sort -u (upstream fix), multibyte fixes in cut and exp

Ondrej Vasik ovasik at fedoraproject.org
Mon Aug 20 11:50:13 UTC 2012


commit 72b7ef7f55d513c096a44ff22ead3a026c907727
Author: Ondřej Vašík <ovasik at redhat.com>
Date:   Mon Aug 20 13:49:47 2012 +0200

    fix possible free memory read and dataloss in sort -u (upstream fix), multibyte fixes in cut and expand (by M.Briza, #821260)

 coreutils-8.17-sort-uniq-fmr.patch |   51 ++++++++++++
 coreutils-i18n.patch               |  156 ++++++++++++++++++------------------
 coreutils.spec                     |    7 ++
 3 files changed, 136 insertions(+), 78 deletions(-)
---
diff --git a/coreutils-8.17-sort-uniq-fmr.patch b/coreutils-8.17-sort-uniq-fmr.patch
new file mode 100644
index 0000000..fb7118a
--- /dev/null
+++ b/coreutils-8.17-sort-uniq-fmr.patch
@@ -0,0 +1,51 @@
+diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
+--- coreutils-8.17-orig/src/sort.c	2012-08-20 13:15:39.703470009 +0200
++++ coreutils-8.17/src/sort.c	2012-08-20 13:29:47.177468563 +0200
+@@ -292,6 +292,9 @@ struct merge_node_queue
+                                    when popping. */
+ };
+ 
++/* Used to implement --unique (-u). */
++static struct line saved_line;
++
+ /* FIXME: None of these tables work with multibyte character sets.
+    Also, there are many other bugs when handling multibyte characters.
+    One way to fix this is to rewrite 'sort' to use wide characters
+@@ -3943,13 +3946,12 @@ queue_pop (struct merge_node_queue *queu
+ static void
+ write_unique (struct line const *line, FILE *tfp, char const *temp_output)
+ {
+-  static struct line saved;
+ 
+   if (unique)
+     {
+-      if (saved.text && ! compare (line, &saved))
++      if (saved_line.text && ! compare (line, &saved_line))
+         return;
+-      saved = *line;
++      saved_line = *line;
+     }
+ 
+   write_line (line, tfp, temp_output);
+@@ -4451,6 +4453,7 @@ sort (char *const *files, size_t nfiles,
+               break;
+             }
+ 
++          saved_line.text = NULL;
+           line = buffer_linelim (&buf);
+           if (buf.eof && !nfiles && !ntemps && !buf.left)
+             {
+diff -urNp coreutils-8.17-orig/tests/misc/sort coreutils-8.17/tests/misc/sort
+--- coreutils-8.17-orig/tests/misc/sort	2012-02-03 10:22:06.000000000 +0100
++++ coreutils-8.17/tests/misc/sort	2012-08-20 13:31:38.685565488 +0200
+@@ -226,6 +226,10 @@ my @Tests =
+ ["15c", '-i -u', {IN=>"a\1\na\n"}, {OUT=>"a\1\n"}],
+ ["15d", '-i -u', {IN=>"\1a\na\n"}, {OUT=>"\1a\n"}],
+ ["15e", '-i -u', {IN=>"a\n\1\1\1\1\1a\1\1\1\1\n"}, {OUT=>"a\n"}],
++# Before 8.19, this would trigger a free-memory read.
++["unique-free-mem-read", '-u --p=1 -S32b',
++ {IN=>"a\n"."b"x900 ."\n"},
++ {OUT=>"a\n"."b"x900 ."\n"}],
+ 
+ # From Erick Branderhorst -- fixed around 1.19e
+ ["16a", '-f',
diff --git a/coreutils-i18n.patch b/coreutils-i18n.patch
index 5b0d3b8..7ddc72c 100644
--- a/coreutils-i18n.patch
+++ b/coreutils-i18n.patch
@@ -1,6 +1,6 @@
-diff -urNp coreutils-8.16-orig/lib/linebuffer.h coreutils-8.16/lib/linebuffer.h
---- coreutils-8.16-orig/lib/linebuffer.h	2012-01-06 10:14:31.000000000 +0100
-+++ coreutils-8.16/lib/linebuffer.h	2012-03-26 18:02:00.993889446 +0200
+diff -urNp coreutils-8.17-orig/lib/linebuffer.h coreutils-8.17/lib/linebuffer.h
+--- coreutils-8.17-orig/lib/linebuffer.h	2012-01-06 10:14:31.000000000 +0100
++++ coreutils-8.17/lib/linebuffer.h	2012-08-20 12:52:26.658468803 +0200
 @@ -21,6 +21,11 @@
  
  # include <stdio.h>
@@ -23,9 +23,9 @@ diff -urNp coreutils-8.16-orig/lib/linebuffer.h coreutils-8.16/lib/linebuffer.h
  };
  
  /* Initialize linebuffer LINEBUFFER for use. */
-diff -urNp coreutils-8.16-orig/src/cut.c coreutils-8.16/src/cut.c
---- coreutils-8.16-orig/src/cut.c	2012-03-24 21:26:51.000000000 +0100
-+++ coreutils-8.16/src/cut.c	2012-03-26 17:46:48.000000000 +0200
+diff -urNp coreutils-8.17-orig/src/cut.c coreutils-8.17/src/cut.c
+--- coreutils-8.17-orig/src/cut.c	2012-05-02 10:31:47.000000000 +0200
++++ coreutils-8.17/src/cut.c	2012-08-20 12:57:52.533805458 +0200
 @@ -28,6 +28,11 @@
  #include <assert.h>
  #include <getopt.h>
@@ -376,7 +376,7 @@ diff -urNp coreutils-8.16-orig/src/cut.c coreutils-8.16/src/cut.c
 +                break;
 +            }
 +
-+          if (wc == WEOF)
++          if (len<=0 && wc == WEOF)
 +            break;
 +
 +          /* If the first field extends to the end of line (it is not
@@ -633,9 +633,9 @@ diff -urNp coreutils-8.16-orig/src/cut.c coreutils-8.16/src/cut.c
      }
  
    if (optind == argc)
-diff -urNp coreutils-8.16-orig/src/expand.c coreutils-8.16/src/expand.c
---- coreutils-8.16-orig/src/expand.c	2012-03-24 21:26:51.000000000 +0100
-+++ coreutils-8.16/src/expand.c	2012-03-26 17:42:56.000000000 +0200
+diff -urNp coreutils-8.17-orig/src/expand.c coreutils-8.17/src/expand.c
+--- coreutils-8.17-orig/src/expand.c	2012-05-01 22:55:08.000000000 +0200
++++ coreutils-8.17/src/expand.c	2012-08-20 12:59:28.995468227 +0200
 @@ -37,12 +37,29 @@
  #include <stdio.h>
  #include <getopt.h>
@@ -733,7 +733,7 @@ diff -urNp coreutils-8.16-orig/src/expand.c coreutils-8.16/src/expand.c
 +	  if (convert)
 +	    {
 +	      ++column;
-+	      if (convert_entire_line == 0)
++	      if (convert_entire_line == 0 && !isblank(*bufpos))
 +		convert = 0;
 +	    }
 +	  putchar (*bufpos);
@@ -793,7 +793,7 @@ diff -urNp coreutils-8.16-orig/src/expand.c coreutils-8.16/src/expand.c
 +
 +		      width = wcwidth (wc);
 +		      column += (width > 0) ? width : 0;
-+		      if (convert_entire_line == 0)
++		      if (convert_entire_line == 0 && !iswblank(wc))
 +			convert = 0;
 +		    }
 +		}
@@ -823,9 +823,9 @@ diff -urNp coreutils-8.16-orig/src/expand.c coreutils-8.16/src/expand.c
  
    if (have_read_stdin && fclose (stdin) != 0)
      error (EXIT_FAILURE, errno, "-");
-diff -urNp coreutils-8.16-orig/src/fold.c coreutils-8.16/src/fold.c
---- coreutils-8.16-orig/src/fold.c	2012-03-24 19:22:13.000000000 +0100
-+++ coreutils-8.16/src/fold.c	2012-03-26 17:48:37.000000000 +0200
+diff -urNp coreutils-8.17-orig/src/fold.c coreutils-8.17/src/fold.c
+--- coreutils-8.17-orig/src/fold.c	2012-04-29 13:45:30.000000000 +0200
++++ coreutils-8.17/src/fold.c	2012-08-20 12:52:26.662467902 +0200
 @@ -22,12 +22,34 @@
  #include <getopt.h>
  #include <sys/types.h>
@@ -1223,9 +1223,9 @@ diff -urNp coreutils-8.16-orig/src/fold.c coreutils-8.16/src/fold.c
            break;
  
          case 's':		/* Break at word boundaries. */
-diff -urNp coreutils-8.16-orig/src/join.c coreutils-8.16/src/join.c
---- coreutils-8.16-orig/src/join.c	2012-03-24 21:26:51.000000000 +0100
-+++ coreutils-8.16/src/join.c	2012-03-26 17:50:02.000000000 +0200
+diff -urNp coreutils-8.17-orig/src/join.c coreutils-8.17/src/join.c
+--- coreutils-8.17-orig/src/join.c	2012-05-02 10:31:47.000000000 +0200
++++ coreutils-8.17/src/join.c	2012-08-20 12:52:26.664470970 +0200
 @@ -22,18 +22,32 @@
  #include <sys/types.h>
  #include <getopt.h>
@@ -1701,9 +1701,9 @@ diff -urNp coreutils-8.16-orig/src/join.c coreutils-8.16/src/join.c
            break;
  
          case NOCHECK_ORDER_OPTION:
-diff -urNp coreutils-8.16-orig/src/pr.c coreutils-8.16/src/pr.c
---- coreutils-8.16-orig/src/pr.c	2012-03-24 21:26:51.000000000 +0100
-+++ coreutils-8.16/src/pr.c	2012-03-26 17:50:48.000000000 +0200
+diff -urNp coreutils-8.17-orig/src/pr.c coreutils-8.17/src/pr.c
+--- coreutils-8.17-orig/src/pr.c	2012-05-10 09:14:30.000000000 +0200
++++ coreutils-8.17/src/pr.c	2012-08-20 12:52:26.669468730 +0200
 @@ -312,6 +312,32 @@
  
  #include <getopt.h>
@@ -2448,8 +2448,8 @@ diff -urNp coreutils-8.16-orig/src/pr.c coreutils-8.16/src/pr.c
     looking for more options and printing the next batch of files.
  
 diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
---- coreutils-8.17-orig/src/sort.c
-+++ coreutils-8.17/src/sort.c
+--- coreutils-8.17-orig/src/sort.c	2012-05-04 12:06:22.000000000 +0200
++++ coreutils-8.17/src/sort.c	2012-08-20 12:52:26.675467884 +0200
 @@ -22,12 +22,21 @@
  
  #include <config.h>
@@ -2472,7 +2472,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
  #include "system.h"
  #include "argmatch.h"
  #include "error.h"
-@@ -167,12 +176,34 @@ static int thousands_sep;
+@@ -165,12 +174,34 @@ static int thousands_sep;
  
  /* Nonzero if the corresponding locales are hard.  */
  static bool hard_LC_COLLATE;
@@ -2508,7 +2508,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
  /* The kind of blanks for '-b' to skip in various options. */
  enum blanktype { bl_start, bl_end, bl_both };
  
-@@ -343,13 +374,11 @@ static bool reverse;
+@@ -341,13 +372,11 @@ static bool reverse;
     they were read if all keys compare equal.  */
  static bool stable;
  
@@ -2525,7 +2525,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
  
  /* Flag to remove consecutive duplicate lines from the output.
     Only the last of a sequence of equal lines will be output. */
-@@ -782,6 +811,46 @@ reap_all (void)
+@@ -780,6 +809,46 @@ reap_all (void)
      reap (-1);
  }
  
@@ -2572,7 +2572,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
  /* Clean up any remaining temporary files.  */
  
  static void
-@@ -1214,7 +1283,7 @@ zaptemp (char const *name)
+@@ -1212,7 +1281,7 @@ zaptemp (char const *name)
    free (node);
  }
  
@@ -2581,7 +2581,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
  
  static int
  struct_month_cmp (void const *m1, void const *m2)
-@@ -1229,7 +1298,7 @@ struct_month_cmp (void const *m1, void c
+@@ -1227,7 +1296,7 @@ struct_month_cmp (void const *m1, void c
  /* Initialize the character class tables. */
  
  static void
@@ -2590,7 +2590,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
  {
    size_t i;
  
-@@ -1241,7 +1310,7 @@ inittables (void)
+@@ -1239,7 +1308,7 @@ inittables (void)
        fold_toupper[i] = toupper (i);
      }
  
@@ -2599,7 +2599,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
    /* If we're not in the "C" locale, read different names for months.  */
    if (hard_LC_TIME)
      {
-@@ -1323,6 +1392,84 @@ specify_nmerge (int oi, char c, char con
+@@ -1321,6 +1390,84 @@ specify_nmerge (int oi, char c, char con
      xstrtol_fatal (e, oi, c, long_options, s);
  }
  
@@ -2684,7 +2684,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
  /* Specify the amount of main memory to use when sorting.  */
  static void
  specify_sort_size (int oi, char c, char const *s)
-@@ -1551,7 +1698,7 @@ buffer_linelim (struct buffer const *buf
+@@ -1549,7 +1696,7 @@ buffer_linelim (struct buffer const *buf
     by KEY in LINE. */
  
  static char *
@@ -2693,7 +2693,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
  {
    char *ptr = line->text, *lim = ptr + line->length - 1;
    size_t sword = key->sword;
-@@ -1560,10 +1707,10 @@ begfield (struct line const *line, struc
+@@ -1558,10 +1705,10 @@ begfield (struct line const *line, struc
    /* The leading field separator itself is included in a field when -t
       is absent.  */
  
@@ -2706,7 +2706,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
            ++ptr;
          if (ptr < lim)
            ++ptr;
-@@ -1589,11 +1736,70 @@ begfield (struct line const *line, struc
+@@ -1587,11 +1734,70 @@ begfield (struct line const *line, struc
    return ptr;
  }
  
@@ -2778,7 +2778,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
  {
    char *ptr = line->text, *lim = ptr + line->length - 1;
    size_t eword = key->eword, echar = key->echar;
-@@ -1608,10 +1814,10 @@ limfield (struct line const *line, struc
+@@ -1606,10 +1812,10 @@ limfield (struct line const *line, struc
       'beginning' is the first character following the delimiting TAB.
       Otherwise, leave PTR pointing at the first 'blank' character after
       the preceding field.  */
@@ -2791,7 +2791,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
            ++ptr;
          if (ptr < lim && (eword || echar))
            ++ptr;
-@@ -1657,10 +1863,10 @@ limfield (struct line const *line, struc
+@@ -1655,10 +1861,10 @@ limfield (struct line const *line, struc
       */
  
    /* Make LIM point to the end of (one byte past) the current field.  */
@@ -2804,7 +2804,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
        if (newlim)
          lim = newlim;
      }
-@@ -1691,6 +1897,130 @@ limfield (struct line const *line, struc
+@@ -1689,6 +1895,130 @@ limfield (struct line const *line, struc
    return ptr;
  }
  
@@ -2935,7 +2935,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
  /* Fill BUF reading from FP, moving buf->left bytes from the end
     of buf->buf to the beginning first.  If EOF is reached and the
     file wasn't terminated by a newline, supply one.  Set up BUF's line
-@@ -1777,8 +2107,22 @@ fillbuf (struct buffer *buf, FILE *fp, c
+@@ -1775,8 +2105,22 @@ fillbuf (struct buffer *buf, FILE *fp, c
                    else
                      {
                        if (key->skipsblanks)
@@ -2960,7 +2960,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
                        line->keybeg = line_start;
                      }
                  }
-@@ -1899,7 +2243,7 @@ human_numcompare (char const *a, char co
+@@ -1897,7 +2241,7 @@ human_numcompare (char const *a, char co
     hideously fast. */
  
  static int
@@ -2969,7 +2969,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
  {
    while (blanks[to_uchar (*a)])
      a++;
-@@ -1909,6 +2253,25 @@ numcompare (char const *a, char const *b
+@@ -1907,6 +2251,25 @@ numcompare (char const *a, char const *b
    return strnumcmp (a, b, decimal_point, thousands_sep);
  }
  
@@ -2995,7 +2995,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
  /* Work around a problem whereby the long double value returned by glibc's
     strtold ("NaN", ...) contains uninitialized bits: clear all bytes of
     A and B before calling strtold.  FIXME: remove this function once
-@@ -1959,7 +2322,7 @@ general_numcompare (char const *sa, char
+@@ -1957,7 +2320,7 @@ general_numcompare (char const *sa, char
     Return 0 if the name in S is not recognized.  */
  
  static int
@@ -3004,7 +3004,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
  {
    size_t lo = 0;
    size_t hi = MONTHS_PER_YEAR;
-@@ -2234,15 +2597,14 @@ debug_key (struct line const *line, stru
+@@ -2232,15 +2595,14 @@ debug_key (struct line const *line, stru
            char saved = *lim;
            *lim = '\0';
  
@@ -3022,7 +3022,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
            else if (key->general_numeric)
              ignore_value (strtold (beg, &tighter_lim));
            else if (key->numeric || key->human_numeric)
-@@ -2386,7 +2748,7 @@ key_warnings (struct keyfield const *gke
+@@ -2384,7 +2746,7 @@ key_warnings (struct keyfield const *gke
        bool maybe_space_aligned = !hard_LC_COLLATE && default_key_compare (key)
                                   && !(key->schar || key->echar);
        bool line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y  */
@@ -3031,7 +3031,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
            && ((!key->skipsblanks && !(implicit_skip || maybe_space_aligned))
                || (!key->skipsblanks && key->schar)
                || (!key->skipeblanks && key->echar)))
-@@ -2444,11 +2806,83 @@ key_warnings (struct keyfield const *gke
+@@ -2442,11 +2804,83 @@ key_warnings (struct keyfield const *gke
      error (0, 0, _("option '-r' only applies to last-resort comparison"));
  }
  
@@ -3116,7 +3116,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
  {
    struct keyfield *key = keylist;
  
-@@ -2533,7 +2967,7 @@ keycompare (struct line const *a, struct
+@@ -2531,7 +2965,7 @@ keycompare (struct line const *a, struct
            else if (key->human_numeric)
              diff = human_numcompare (ta, tb);
            else if (key->month)
@@ -3125,7 +3125,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
            else if (key->random)
              diff = compare_random (ta, tlena, tb, tlenb);
            else if (key->version)
-@@ -2649,6 +3083,180 @@ keycompare (struct line const *a, struct
+@@ -2647,6 +3081,180 @@ keycompare (struct line const *a, struct
    return key->reverse ? -diff : diff;
  }
  
@@ -3306,7 +3306,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
  /* Compare two lines A and B, returning negative, zero, or positive
     depending on whether A compares less than, equal to, or greater than B. */
  
-@@ -4109,7 +4717,7 @@ main (int argc, char **argv)
+@@ -4107,7 +4715,7 @@ main (int argc, char **argv)
    initialize_exit_failure (SORT_FAILURE);
  
    hard_LC_COLLATE = hard_locale (LC_COLLATE);
@@ -3315,7 +3315,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
    hard_LC_TIME = hard_locale (LC_TIME);
  #endif
  
-@@ -4130,6 +4738,29 @@ main (int argc, char **argv)
+@@ -4128,6 +4736,29 @@ main (int argc, char **argv)
        thousands_sep = -1;
    }
  
@@ -3345,7 +3345,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
    have_read_stdin = false;
    inittables ();
  
-@@ -4400,13 +5031,34 @@ main (int argc, char **argv)
+@@ -4398,13 +5029,34 @@ main (int argc, char **argv)
  
          case 't':
            {
@@ -3384,7 +3384,7 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
                  else
                    {
                      /* Provoke with 'sort -txx'.  Complain about
-@@ -4417,9 +5069,12 @@ main (int argc, char **argv)
+@@ -4415,9 +5067,12 @@ main (int argc, char **argv)
                             quote (optarg));
                    }
                }
@@ -3399,9 +3399,9 @@ diff -urNp coreutils-8.17-orig/src/sort.c coreutils-8.17/src/sort.c
            }
            break;
  
-diff -urNp coreutils-8.16-orig/src/unexpand.c coreutils-8.16/src/unexpand.c
---- coreutils-8.16-orig/src/unexpand.c	2012-03-24 21:26:51.000000000 +0100
-+++ coreutils-8.16/src/unexpand.c	2012-03-26 17:51:46.000000000 +0200
+diff -urNp coreutils-8.17-orig/src/unexpand.c coreutils-8.17/src/unexpand.c
+--- coreutils-8.17-orig/src/unexpand.c	2012-05-01 22:55:08.000000000 +0200
++++ coreutils-8.17/src/unexpand.c	2012-08-20 12:52:26.677470358 +0200
 @@ -38,12 +38,29 @@
  #include <stdio.h>
  #include <getopt.h>
@@ -3655,9 +3655,9 @@ diff -urNp coreutils-8.16-orig/src/unexpand.c coreutils-8.16/src/unexpand.c
  
    if (have_read_stdin && fclose (stdin) != 0)
      error (EXIT_FAILURE, errno, "-");
-diff -urNp coreutils-8.16-orig/src/uniq.c coreutils-8.16/src/uniq.c
---- coreutils-8.16-orig/src/uniq.c	2012-03-24 21:26:51.000000000 +0100
-+++ coreutils-8.16/src/uniq.c	2012-03-26 17:35:09.000000000 +0200
+diff -urNp coreutils-8.17-orig/src/uniq.c coreutils-8.17/src/uniq.c
+--- coreutils-8.17-orig/src/uniq.c	2012-05-01 22:55:08.000000000 +0200
++++ coreutils-8.17/src/uniq.c	2012-08-20 12:52:26.679468083 +0200
 @@ -21,6 +21,16 @@
  #include <getopt.h>
  #include <sys/types.h>
@@ -4023,10 +4023,10 @@ diff -urNp coreutils-8.16-orig/src/uniq.c coreutils-8.16/src/uniq.c
    skip_chars = 0;
    skip_fields = 0;
    check_chars = SIZE_MAX;
-diff -urNp coreutils-8.16-orig/tests/Makefile.am coreutils-8.16/tests/Makefile.am
---- coreutils-8.16-orig/tests/Makefile.am	2012-03-26 18:01:35.564014659 +0200
-+++ coreutils-8.16/tests/Makefile.am	2012-03-26 18:02:01.023015013 +0200
-@@ -242,6 +242,7 @@ TESTS =						\
+diff -urNp coreutils-8.17-orig/tests/Makefile.am coreutils-8.17/tests/Makefile.am
+--- coreutils-8.17-orig/tests/Makefile.am	2012-08-20 12:52:07.846555240 +0200
++++ coreutils-8.17/tests/Makefile.am	2012-08-20 12:52:26.680469779 +0200
+@@ -246,6 +246,7 @@ TESTS =						\
    misc/sort-debug-warn				\
    misc/sort-discrim				\
    misc/sort-files0-from				\
@@ -4034,7 +4034,7 @@ diff -urNp coreutils-8.16-orig/tests/Makefile.am coreutils-8.16/tests/Makefile.a
    misc/sort-float				\
    misc/sort-merge				\
    misc/sort-merge-fdlimit			\
-@@ -537,6 +538,10 @@ TESTS =						\
+@@ -543,6 +544,10 @@ TESTS =						\
    $(root_tests)
  
  pr_data =					\
@@ -4045,9 +4045,9 @@ diff -urNp coreutils-8.16-orig/tests/Makefile.am coreutils-8.16/tests/Makefile.a
    pr/0F						\
    pr/0FF					\
    pr/0FFnt					\
-diff -urNp coreutils-8.16-orig/tests/misc/cut coreutils-8.16/tests/misc/cut
---- coreutils-8.16-orig/tests/misc/cut	2012-02-03 10:22:06.000000000 +0100
-+++ coreutils-8.16/tests/misc/cut	2012-03-26 17:40:49.000000000 +0200
+diff -urNp coreutils-8.17-orig/tests/misc/cut coreutils-8.17/tests/misc/cut
+--- coreutils-8.17-orig/tests/misc/cut	2012-02-03 10:22:06.000000000 +0100
++++ coreutils-8.17/tests/misc/cut	2012-08-20 12:52:26.681467766 +0200
 @@ -23,14 +23,15 @@ use strict;
  # Turn off localization of executable's output.
  @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
@@ -4077,41 +4077,41 @@ diff -urNp coreutils-8.16-orig/tests/misc/cut coreutils-8.16/tests/misc/cut
    ['inval2', qw(-f -), {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}],
    ['inval3', '-f', '4,-', {IN=>''}, {OUT=>''}, {EXIT=>1}, {ERR=>$no_endpoint}],
    ['inval4', '-f', '1-2,-', {IN=>''}, {OUT=>''}, {EXIT=>1},
-diff -urNp coreutils-8.16-orig/tests/misc/mb1.I coreutils-8.16/tests/misc/mb1.I
---- coreutils-8.16-orig/tests/misc/mb1.I	1970-01-01 01:00:00.000000000 +0100
-+++ coreutils-8.16/tests/misc/mb1.I	2012-03-26 17:35:09.000000000 +0200
+diff -urNp coreutils-8.17-orig/tests/misc/mb1.I coreutils-8.17/tests/misc/mb1.I
+--- coreutils-8.17-orig/tests/misc/mb1.I	1970-01-01 01:00:00.000000000 +0100
++++ coreutils-8.17/tests/misc/mb1.I	2012-08-20 12:52:26.682468139 +0200
 @@ -0,0 +1,4 @@
 +Apple@10
 +Banana@5
 +Citrus@20
 +Cherry@30
-diff -urNp coreutils-8.16-orig/tests/misc/mb1.X coreutils-8.16/tests/misc/mb1.X
---- coreutils-8.16-orig/tests/misc/mb1.X	1970-01-01 01:00:00.000000000 +0100
-+++ coreutils-8.16/tests/misc/mb1.X	2012-03-26 17:35:09.000000000 +0200
+diff -urNp coreutils-8.17-orig/tests/misc/mb1.X coreutils-8.17/tests/misc/mb1.X
+--- coreutils-8.17-orig/tests/misc/mb1.X	1970-01-01 01:00:00.000000000 +0100
++++ coreutils-8.17/tests/misc/mb1.X	2012-08-20 12:52:26.682468139 +0200
 @@ -0,0 +1,4 @@
 +Banana@5
 +Apple@10
 +Citrus@20
 +Cherry@30
-diff -urNp coreutils-8.16-orig/tests/misc/mb2.I coreutils-8.16/tests/misc/mb2.I
---- coreutils-8.16-orig/tests/misc/mb2.I	1970-01-01 01:00:00.000000000 +0100
-+++ coreutils-8.16/tests/misc/mb2.I	2012-03-26 17:35:09.000000000 +0200
+diff -urNp coreutils-8.17-orig/tests/misc/mb2.I coreutils-8.17/tests/misc/mb2.I
+--- coreutils-8.17-orig/tests/misc/mb2.I	1970-01-01 01:00:00.000000000 +0100
++++ coreutils-8.17/tests/misc/mb2.I	2012-08-20 12:52:26.683472746 +0200
 @@ -0,0 +1,4 @@
 +Apple@AA10@@20
 +Banana@AA5@@30
 +Citrus@AA20@@5
 +Cherry@AA30@@10
-diff -urNp coreutils-8.16-orig/tests/misc/mb2.X coreutils-8.16/tests/misc/mb2.X
---- coreutils-8.16-orig/tests/misc/mb2.X	1970-01-01 01:00:00.000000000 +0100
-+++ coreutils-8.16/tests/misc/mb2.X	2012-03-26 17:35:09.000000000 +0200
+diff -urNp coreutils-8.17-orig/tests/misc/mb2.X coreutils-8.17/tests/misc/mb2.X
+--- coreutils-8.17-orig/tests/misc/mb2.X	1970-01-01 01:00:00.000000000 +0100
++++ coreutils-8.17/tests/misc/mb2.X	2012-08-20 12:52:26.684468471 +0200
 @@ -0,0 +1,4 @@
 +Citrus@AA20@@5
 +Cherry@AA30@@10
 +Apple@AA10@@20
 +Banana@AA5@@30
-diff -urNp coreutils-8.16-orig/tests/misc/sort-mb-tests coreutils-8.16/tests/misc/sort-mb-tests
---- coreutils-8.16-orig/tests/misc/sort-mb-tests	1970-01-01 01:00:00.000000000 +0100
-+++ coreutils-8.16/tests/misc/sort-mb-tests	2012-03-26 17:35:09.000000000 +0200
+diff -urNp coreutils-8.17-orig/tests/misc/sort-mb-tests coreutils-8.17/tests/misc/sort-mb-tests
+--- coreutils-8.17-orig/tests/misc/sort-mb-tests	1970-01-01 01:00:00.000000000 +0100
++++ coreutils-8.17/tests/misc/sort-mb-tests	2012-08-20 12:52:26.684468471 +0200
 @@ -0,0 +1,58 @@
 +#! /bin/sh
 +case $# in
diff --git a/coreutils.spec b/coreutils.spec
index 9281d4d..1aa2fc7 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -19,6 +19,7 @@ Source203:  coreutils-runuser-l.pamd
 
 # From upstream
 Patch1: coreutils-8.17-ls-rootdir-symlink.patch
+Patch2: coreutils-8.17-sort-uniq-fmr.patch
 
 # Our patches
 #general patch to workaround koji build system issues
@@ -146,6 +147,7 @@ the old GNU fileutils, sh-utils, and textutils packages.
 
 # From upstream
 %patch1 -p1 -b .roodirsymlink
+%patch2 -p1 -b .fmr
 
 # Our patches
 %patch100 -p1 -b .configure
@@ -419,6 +421,11 @@ fi
 %{?!norunuser:%{_sbindir}/runuser}
 
 %changelog
+* Mon Aug 20 2012 Ondrej Vasik <ovasik at redhat.com> 8.17-5
+- fix possible free memory read and dataloss in sort -u
+  (upstream fix)
+- multibyte fixes in cut and expand (by M.Briza, #821260)
+
 * Wed Jul 18 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 8.17-4
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
 


More information about the scm-commits mailing list