- Fix a segfault issue. (#452810)

This commit is contained in:
Akira TAGOH 2008-06-25 08:32:24 +00:00
parent 9f5e44d23c
commit 3c9cf6c1bd
2 changed files with 34 additions and 1 deletions

View File

@ -0,0 +1,28 @@
diff -pruN ruby-1.8.6-p230.orig/string.c ruby-1.8.6-p230/string.c
--- ruby-1.8.6-p230.orig/string.c 2008-06-20 18:24:53.000000000 +0900
+++ ruby-1.8.6-p230/string.c 2008-06-25 16:10:17.000000000 +0900
@@ -693,9 +693,13 @@ str_buf_cat(str, ptr, len)
const char *ptr;
long len;
{
- long capa, total;
+ long capa, total, off = -1;
rb_str_modify(str);
+ if (ptr >= RSTRING(str)->ptr && ptr <= RSTRING(str)->ptr + RSTRING(str)->len) {
+ off = ptr - RSTRING(str)->ptr;
+ }
+ if (len == 0) return 0;
if (FL_TEST(str, STR_ASSOC)) {
FL_UNSET(str, STR_ASSOC);
capa = RSTRING(str)->aux.capa = RSTRING(str)->len;
@@ -717,6 +721,9 @@ str_buf_cat(str, ptr, len)
}
RESIZE_CAPA(str, capa);
}
+ if (off != -1) {
+ ptr = RSTRING(str)->ptr + off;
+ }
memcpy(RSTRING(str)->ptr + RSTRING(str)->len, ptr, len);
RSTRING(str)->len = total;
RSTRING(str)->ptr[total] = '\0'; /* sentinel */

View File

@ -12,7 +12,7 @@
Name: ruby Name: ruby
Version: %{rubyver}%{?dotpatchlevel} Version: %{rubyver}%{?dotpatchlevel}
Release: 1%{?dist} Release: 2%{?dist}
License: Ruby or GPLv2 License: Ruby or GPLv2
URL: http://www.ruby-lang.org/ URL: http://www.ruby-lang.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -34,6 +34,7 @@ Patch21: ruby-deprecated-sitelib-search-path.patch
Patch22: ruby-deprecated-search-path.patch Patch22: ruby-deprecated-search-path.patch
Patch23: ruby-multilib.patch Patch23: ruby-multilib.patch
Patch25: ruby-1.8.6.111-gcc43.patch Patch25: ruby-1.8.6.111-gcc43.patch
Patch26: ruby-1.8.6.230-string-str_buf_cat.patch
Summary: An interpreter of object-oriented scripting language Summary: An interpreter of object-oriented scripting language
Group: Development/Languages Group: Development/Languages
@ -152,6 +153,7 @@ pushd %{name}-%{arcver}
%patch23 -p1 %patch23 -p1
%endif %endif
%patch25 -p1 %patch25 -p1
%patch26 -p1
popd popd
%build %build
@ -502,6 +504,9 @@ rm -rf tmp-ruby-docs
%{_datadir}/emacs/site-lisp/site-start.d/ruby-mode-init.el %{_datadir}/emacs/site-lisp/site-start.d/ruby-mode-init.el
%changelog %changelog
* Wed Jun 25 2008 Akira TAGOH <tagoh@redhat.com> - 1.8.6.230-2
- Fix a segfault issue. (#452810)
* Tue Jun 24 2008 Akira TAGOH <tagoh@redhat.com> - 1.8.6.230-1 * Tue Jun 24 2008 Akira TAGOH <tagoh@redhat.com> - 1.8.6.230-1
- New upstream release. - New upstream release.
- Security fixes. (#452295) - Security fixes. (#452295)