fix double free error in fold for singlebyte locales (caused by multibyte
patch)
This commit is contained in:
parent
61fe33cb1c
commit
266a669f62
@ -1348,7 +1348,7 @@ diff -urNp coreutils-6.11-orig/src/join.c coreutils-6.11/src/join.c
|
|||||||
/* Look for the last blank. */
|
/* Look for the last blank. */
|
||||||
while (logical_end)
|
while (logical_end)
|
||||||
{
|
{
|
||||||
@@ -218,11 +255,225 @@
|
@@ -218,11 +255,222 @@
|
||||||
line_out[offset_out++] = c;
|
line_out[offset_out++] = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1358,7 +1358,6 @@ diff -urNp coreutils-6.11-orig/src/join.c coreutils-6.11/src/join.c
|
|||||||
+ if (offset_out)
|
+ if (offset_out)
|
||||||
+ fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
|
+ fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
|
||||||
+
|
+
|
||||||
+ free(line_out);
|
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+#if HAVE_MBRTOWC
|
+#if HAVE_MBRTOWC
|
||||||
@ -1367,16 +1366,16 @@ diff -urNp coreutils-6.11-orig/src/join.c coreutils-6.11/src/join.c
|
|||||||
+{
|
+{
|
||||||
+ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */
|
+ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */
|
||||||
+ size_t buflen = 0; /* The length of the byte sequence in buf. */
|
+ size_t buflen = 0; /* The length of the byte sequence in buf. */
|
||||||
+ char *bufpos; /* Next read position of BUF. */
|
+ char *bufpos = NULL; /* Next read position of BUF. */
|
||||||
+ wint_t wc; /* A gotten wide character. */
|
+ wint_t wc; /* A gotten wide character. */
|
||||||
+ size_t mblength; /* The byte size of a multibyte character which shows
|
+ size_t mblength; /* The byte size of a multibyte character which shows
|
||||||
+ as same character as WC. */
|
+ as same character as WC. */
|
||||||
+ mbstate_t state, state_bak; /* State of the stream. */
|
+ mbstate_t state, state_bak; /* State of the stream. */
|
||||||
+ int convfail; /* 1, when conversion is failed. Otherwise 0. */
|
+ int convfail; /* 1, when conversion is failed. Otherwise 0. */
|
||||||
+
|
+
|
||||||
+ char *line_out = NULL;
|
+ static char *line_out = NULL;
|
||||||
+ size_t offset_out = 0; /* Index in `line_out' for next char. */
|
+ size_t offset_out = 0; /* Index in `line_out' for next char. */
|
||||||
+ size_t allocated_out = 0;
|
+ static size_t allocated_out = 0;
|
||||||
+
|
+
|
||||||
+ int increment;
|
+ int increment;
|
||||||
+ size_t column = 0;
|
+ size_t column = 0;
|
||||||
@ -1384,7 +1383,7 @@ diff -urNp coreutils-6.11-orig/src/join.c coreutils-6.11/src/join.c
|
|||||||
+ size_t last_blank_pos;
|
+ size_t last_blank_pos;
|
||||||
+ size_t last_blank_column;
|
+ size_t last_blank_column;
|
||||||
+ int is_blank_seen;
|
+ int is_blank_seen;
|
||||||
+ int last_blank_increment;
|
+ int last_blank_increment = 0;
|
||||||
+ int is_bs_following_last_blank;
|
+ int is_bs_following_last_blank;
|
||||||
+ size_t bs_following_last_blank_num;
|
+ size_t bs_following_last_blank_num;
|
||||||
+ int is_cr_after_last_blank;
|
+ int is_cr_after_last_blank;
|
||||||
@ -1503,8 +1502,7 @@ diff -urNp coreutils-6.11-orig/src/join.c coreutils-6.11/src/join.c
|
|||||||
+
|
+
|
||||||
+ if (allocated_out < offset_out + mblength)
|
+ if (allocated_out < offset_out + mblength)
|
||||||
+ {
|
+ {
|
||||||
+ allocated_out += 1024;
|
+ line_out = X2REALLOC (line_out, &allocated_out);
|
||||||
+ line_out = xrealloc (line_out, allocated_out);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ memcpy (line_out + offset_out, bufpos, mblength);
|
+ memcpy (line_out + offset_out, bufpos, mblength);
|
||||||
@ -1536,7 +1534,6 @@ diff -urNp coreutils-6.11-orig/src/join.c coreutils-6.11/src/join.c
|
|||||||
if (offset_out)
|
if (offset_out)
|
||||||
fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
|
fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
|
||||||
|
|
||||||
+ free(line_out);
|
|
||||||
+}
|
+}
|
||||||
+#endif
|
+#endif
|
||||||
+
|
+
|
||||||
|
@ -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.5
|
Version: 7.5
|
||||||
Release: 5%{?dist}
|
Release: 6%{?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/
|
||||||
@ -333,6 +333,10 @@ fi
|
|||||||
%{_libdir}/coreutils
|
%{_libdir}/coreutils
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Sep 10 2009 Ondrej Vasik <ovasik@redhat.com> - 7.5-6
|
||||||
|
- fix double free error in fold for singlebyte locales
|
||||||
|
(caused by multibyte patch)
|
||||||
|
|
||||||
* Tue Sep 08 2009 Ondrej Vasik <ovasik@redhat.com> - 7.5-5
|
* Tue Sep 08 2009 Ondrej Vasik <ovasik@redhat.com> - 7.5-5
|
||||||
- fix sort -h for multibyte locales (reported via
|
- fix sort -h for multibyte locales (reported via
|
||||||
http://bugs.archlinux.org/task/16022)
|
http://bugs.archlinux.org/task/16022)
|
||||||
|
Loading…
Reference in New Issue
Block a user