unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: mongrel-unicorn@rubyforge.org
Subject: [PATCH] http: avoid frozen string bug in filter_body
Date: Tue, 26 Feb 2013 02:56:59 +0000	[thread overview]
Message-ID: <20130226025659.GA17618@dcvr.yhbt.net> (raw)
In-Reply-To: <20130225125753.GA5076@dcvr.yhbt.net>

Eric Wong <normalperson@yhbt.net> wrote:
> I'm stumped that rb_str_modify() doesn't seem to help with
> rb_str_set_len() raising in the chunked parser.  More info here:
> 
> https://bugs.ruby-lang.org/issues/7957
> 
> Any help would be appreciated... It's way past my bed time.

Oops, my fault from 2010 and 2009.  v4.6.2 coming

>From f7ee06592d7709e96f64efb5e7a9485b54415c9d Mon Sep 17 00:00:00 2001
From: Eric Wong <normalperson@yhbt.net>
Date: Tue, 26 Feb 2013 02:52:37 +0000
Subject: [PATCH] http: avoid frozen string bug in filter_body

Our rb_str_modify() became no-ops due to incomplete reverts
of workarounds for old Rubinius, causing rb_str_set_len to
fail with: can't set length of shared string (RuntimeError)

This bug was introduced due to improper workarounds for old
versions of Rubinius in 2009 and 2010:

commit 5e8979ad38efdc4de3a69cc53aea33710d478406
("http: cleanups for latest Rubinius")
commit f37c23704cb73d57e9e478295d1641df1d9104c7
("http: no-op rb_str_modify() for Rubies without it")
---
 ext/unicorn_http/ext_help.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/ext/unicorn_http/ext_help.h b/ext/unicorn_http/ext_help.h
index 0968080..c87c272 100644
--- a/ext/unicorn_http/ext_help.h
+++ b/ext/unicorn_http/ext_help.h
@@ -52,10 +52,6 @@ static void rb_18_str_set_len(VALUE str, long len)
 #  endif
 #endif /* ! defined(NUM2SIZET) */
 
-#ifndef HAVE_RB_STR_MODIFY
-#  define rb_str_modify(x) do {} while (0)
-#endif /* ! defined(HAVE_RB_STR_MODIFY) */
-
 static inline int str_cstr_eq(VALUE val, const char *ptr, long len)
 {
   return (RSTRING_LEN(val) == len && !memcmp(ptr, RSTRING_PTR(val), len));
-- 
Eric Wong
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

      reply	other threads:[~2013-02-26  2:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-25 12:57 weird C extension bug from Ruby 2.0.0-p0 Eric Wong
2013-02-26  2:56 ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/unicorn/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130226025659.GA17618@dcvr.yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=mongrel-unicorn@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).