[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#781901: unblock: ruby2.1/2.1.5-2



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

Please unblock package ruby2.1

This release fixes a segmentation fault when unpacking a byte string
that has been modified since being previously packed (#781504, RC
status).

the debdiff against the package in testing is attached. It is not a
proper debdiff generated from the .dsc files because that would contain
a diff-of-a-diff since I maintain patches in this package as git commits
that get collapsed into a single quilt-style patch when I prepare an
upload.

It also contains a change to debian/upstream-changes that allows people
reading that git repository to inspect which changes have been made to
the upstream source (but has no influence whatsoever on the build or
runtime behavior of the package).

unblock ruby2.1/2.1.5-2

-- System Information:
Debian Release: 8.0
  APT prefers buildd-unstable
  APT policy: (500, 'buildd-unstable'), (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=pt_BR.UTF-8, LC_CTYPE=pt_BR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

-- 
Antonio Terceiro <terceiro@debian.org>
diff --git a/debian/changelog b/debian/changelog
index e0f68ba..eb1753e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+ruby2.1 (2.1.5-2) unstable; urgency=medium
+
+  * Fix Segmentation fault after pack & ioctl & unpack (Closes: #781504)
+    - apply r44804 from upstream svn
+  * debian/upstream-changes: simpler and more accurate implementation
+
+ -- Antonio Terceiro <terceiro@debian.org>  Tue, 31 Mar 2015 21:50:39 -0300
+
 ruby2.1 (2.1.5-1) unstable; urgency=medium
 
   * New upstream release
diff --git a/debian/gbp.conf b/debian/gbp.conf
index cec628c..0e268a7 100644
--- a/debian/gbp.conf
+++ b/debian/gbp.conf
@@ -1,2 +1,3 @@
 [DEFAULT]
 pristine-tar = True
+debian-branch = debian/jessie
diff --git a/debian/upstream-changes b/debian/upstream-changes
index a2306b9..b5b2568 100755
--- a/debian/upstream-changes
+++ b/debian/upstream-changes
@@ -1,10 +1,9 @@
 #!/bin/sh
 
-for commit in $(git log --format=%H --no-merges upstream..); do
-  if test -n "$(git show --name-only --format='%H' $commit | sed -e '1,2d; /^debian\//d')"; then
-    if ! grep -q "^Commit:\s*$commit\s*$" debian/upstream-changes.blacklist; then
-      git --no-pager show --color=always $commit
-      echo
-    fi
-  fi
-done | less -FRSX
+set -e
+
+version=$(dpkg-parsechangelog -SVersion | cut -d - -f 1)
+
+files=$(git diff --name-only upstream/${version}.. | grep -v ^debian)
+
+git log -p --no-merges --cherry-pick upstream/${version}.. -- $files
diff --git a/include/ruby/intern.h b/include/ruby/intern.h
index 46af270..710fa26 100644
--- a/include/ruby/intern.h
+++ b/include/ruby/intern.h
@@ -769,8 +769,8 @@ VALUE rb_str_replace(VALUE, VALUE);
 VALUE rb_str_inspect(VALUE);
 VALUE rb_str_dump(VALUE);
 VALUE rb_str_split(VALUE, const char*);
-void rb_str_associate(VALUE, VALUE);
-VALUE rb_str_associated(VALUE);
+DEPRECATED(void rb_str_associate(VALUE, VALUE));
+DEPRECATED(VALUE rb_str_associated(VALUE));
 void rb_str_setter(VALUE, ID, VALUE*);
 VALUE rb_str_intern(VALUE);
 VALUE rb_sym_to_s(VALUE);
diff --git a/pack.c b/pack.c
index 400e85c..1956500 100644
--- a/pack.c
+++ b/pack.c
@@ -234,6 +234,45 @@ static void qpencode(VALUE,VALUE,long);
 
 static unsigned long utf8_to_uv(const char*,long*);
 
+static ID id_associated;
+
+static void
+str_associate(VALUE str, VALUE add)
+{
+    VALUE assoc;
+
+    assoc = rb_attr_get(str, id_associated);
+    if (RB_TYPE_P(assoc, T_ARRAY)) {
+	/* already associated */
+	rb_ary_concat(assoc, add);
+    }
+    else {
+	rb_ivar_set(str, id_associated, add);
+    }
+}
+
+static VALUE
+str_associated(VALUE str)
+{
+    VALUE assoc = rb_attr_get(str, id_associated);
+    if (NIL_P(assoc)) assoc = Qfalse;
+    return assoc;
+}
+
+void
+rb_str_associate(VALUE str, VALUE add)
+{
+    rb_warn("rb_str_associate() is only for internal use and deprecated; do not use");
+    str_associate(str, add);
+}
+
+VALUE
+rb_str_associated(VALUE str)
+{
+    rb_warn("rb_str_associated() is only for internal use and deprecated; do not use");
+    return str_associated(str);
+}
+
 /*
  *  call-seq:
  *     arr.pack ( aTemplateString ) -> aBinaryString
@@ -921,7 +960,7 @@ pack_pack(VALUE ary, VALUE fmt)
     }
 
     if (associates) {
-	rb_str_associate(res, associates);
+	str_associate(res, associates);
     }
     OBJ_INFECT(res, fmt);
     switch (enc_info) {
@@ -1803,7 +1842,7 @@ pack_unpack(VALUE str, VALUE fmt)
 		    VALUE a;
 		    const VALUE *p, *pend;
 
-		    if (!(a = rb_str_associated(str))) {
+		    if (!(a = str_associated(str))) {
 			rb_raise(rb_eArgError, "no associated pointer");
 		    }
 		    p = RARRAY_CONST_PTR(a);
@@ -1812,7 +1851,7 @@ pack_unpack(VALUE str, VALUE fmt)
 			if (RB_TYPE_P(*p, T_STRING) && RSTRING_PTR(*p) == t) {
 			    if (len < RSTRING_LEN(*p)) {
 				tmp = rb_tainted_str_new(t, len);
-				rb_str_associate(tmp, a);
+				str_associate(tmp, a);
 			    }
 			    else {
 				tmp = *p;
@@ -1846,7 +1885,7 @@ pack_unpack(VALUE str, VALUE fmt)
 			VALUE a;
 			const VALUE *p, *pend;
 
-			if (!(a = rb_str_associated(str))) {
+			if (!(a = str_associated(str))) {
 			    rb_raise(rb_eArgError, "no associated pointer");
 			}
 			p = RARRAY_CONST_PTR(a);
@@ -2008,4 +2047,6 @@ Init_pack(void)
 {
     rb_define_method(rb_cArray, "pack", pack_pack, 1);
     rb_define_method(rb_cString, "unpack", pack_unpack, 1);
+
+    id_associated = rb_intern_const("__pack_associated__");
 }
diff --git a/string.c b/string.c
index e6f72bc..4d8e913 100644
--- a/string.c
+++ b/string.c
@@ -1536,47 +1536,6 @@ str_discard(VALUE str)
 }
 
 void
-rb_str_associate(VALUE str, VALUE add)
-{
-    /* sanity check */
-    rb_check_frozen(str);
-    if (STR_ASSOC_P(str)) {
-	/* already associated */
-	rb_ary_concat(RSTRING(str)->as.heap.aux.shared, add);
-    }
-    else {
-	if (STR_SHARED_P(str)) {
-	    VALUE assoc = RSTRING(str)->as.heap.aux.shared;
-	    str_make_independent(str);
-	    if (STR_ASSOC_P(assoc)) {
-		assoc = RSTRING(assoc)->as.heap.aux.shared;
-		rb_ary_concat(assoc, add);
-		add = assoc;
-	    }
-	}
-	else if (STR_EMBED_P(str)) {
-	    str_make_independent(str);
-	}
-	else if (RSTRING(str)->as.heap.aux.capa != RSTRING_LEN(str)) {
-	    RESIZE_CAPA(str, RSTRING_LEN(str));
-	}
-	FL_SET(str, STR_ASSOC);
-	RBASIC_CLEAR_CLASS(add);
-	RB_OBJ_WRITE(str, &RSTRING(str)->as.heap.aux.shared, add);
-    }
-}
-
-VALUE
-rb_str_associated(VALUE str)
-{
-    if (STR_SHARED_P(str)) str = RSTRING(str)->as.heap.aux.shared;
-    if (STR_ASSOC_P(str)) {
-	return RSTRING(str)->as.heap.aux.shared;
-    }
-    return Qfalse;
-}
-
-void
 rb_must_asciicompat(VALUE str)
 {
     rb_encoding *enc = rb_enc_get(str);
diff --git a/test/ruby/test_pack.rb b/test/ruby/test_pack.rb
index 4b089f7..64d1e68 100644
--- a/test/ruby/test_pack.rb
+++ b/test/ruby/test_pack.rb
@@ -181,7 +181,7 @@ class TestPack < Test::Unit::TestCase
     assert_equal a[0], a.pack("p").unpack("p")[0]
     assert_equal a, a.pack("p").freeze.unpack("p*")
     assert_raise(ArgumentError) { (a.pack("p") + "").unpack("p*") }
-    assert_raise(ArgumentError) { (a.pack("p") << "d").unpack("p*") }
+    assert_equal a, (a.pack("p") << "d").unpack("p*")
   end
 
   def test_format_string_modified

Attachment: signature.asc
Description: Digital signature


Reply to: