[coreutils: 1/2] fix pr -c and pr -v segfault with multibyte locales

Ondrej Vasik ovasik at fedoraproject.org
Thu Jan 5 14:35:42 UTC 2012


commit 586a3174f1b4919626c03518759375f9c4f4ba71
Author: Ondřej Vašík <ovasik at redhat.com>
Date:   Thu Jan 5 15:34:33 2012 +0100

    fix pr -c and pr -v segfault with multibyte locales

 coreutils-i18n.patch |    7 ++++---
 coreutils.spec       |    5 ++++-
 2 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/coreutils-i18n.patch b/coreutils-i18n.patch
index 96eec34..4de494f 100644
--- a/coreutils-i18n.patch
+++ b/coreutils-i18n.patch
@@ -2271,7 +2271,7 @@ diff -urNp coreutils-8.13-orig/src/pr.c coreutils-8.13/src/pr.c
      {
        width = TAB_WIDTH (chars_per_c, input_position);
  
-@@ -2741,6 +2942,154 @@ char_to_clump (char c)
+@@ -2741,6 +2942,155 @@ char_to_clump (char c)
    return chars;
  }
  
@@ -2279,6 +2279,7 @@ diff -urNp coreutils-8.13-orig/src/pr.c coreutils-8.13/src/pr.c
 +static int
 +char_to_clump_multi (char c)
 +{
++  unsigned char uc = c;
 +  static size_t mbc_pos = 0;
 +  static char mbc[MB_LEN_MAX] = {'\0'};
 +  static mbstate_t state = {'\0'};
@@ -2365,7 +2366,7 @@ diff -urNp coreutils-8.13-orig/src/pr.c coreutils-8.13/src/pr.c
 +                      width += 4;
 +                      chars += 4;
 +                      *s++ = '\\';
-+                      sprintf (esc_buff, "%03o", c);
++                      sprintf (esc_buff, "%03o", uc);
 +                      for (j = 0; j <= 2; ++j)
 +                        *s++ = (int) esc_buff[j];
 +                    }
@@ -2386,7 +2387,7 @@ diff -urNp coreutils-8.13-orig/src/pr.c coreutils-8.13/src/pr.c
 +                          width += 4;
 +                          chars += 4;
 +                          *s++ = '\\';
-+                          sprintf (esc_buff, "%03o", c);
++                          sprintf (esc_buff, "%03o", uc);
 +                          for (j = 0; j <= 2; ++j)
 +                            *s++ = (int) esc_buff[j];
 +                        }
diff --git a/coreutils.spec b/coreutils.spec
index 7f3d56d..5a93cd0 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
 Summary: A set of basic GNU tools commonly used in shell scripts
 Name:    coreutils
 Version: 8.14
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: GPLv3+
 Group:   System Environment/Base
 Url:     http://www.gnu.org/software/coreutils/
@@ -322,6 +322,9 @@ fi
 %{?!norunuser:/sbin/runuser}
 
 %changelog
+* Thu Jan 05 2011 Ondrej Vasik <ovasik at redhat.com> - 8.14-4
+- fix pr -c and pr -v segfault with multibyte locales
+
 * Mon Oct 24 2011 Ondrej Vasik <ovasik at redhat.com> - 8.14-3
 - require at least pam 1.1.3-7 (#748215)
 


More information about the scm-commits mailing list