[#43186] [Ruby 1.9-Bug#4388][Open] open-uriで環境変数http_proxyを使うときに認証付きのProxyが使えません — あつし よしだ <redmine@...>

Bug #4388: open-uri=E3=81=A7=E7=92=B0=E5=A2=83=E5=A4=89=E6=95=B0http_prox=

11 messages 2011/02/10
[#43192] [Ruby 1.9-Bug#4388] open-uriで環境変数http_proxyを使うときに認証付きのProxyが使えません — あつし よしだ <redmine@...> 2011/02/11

チケット #4388 が更新されました。 (by あつし よしだ)

[#43193] Re: [Ruby 1.9-Bug#4388] open-uriで環境変数http_proxyを使うときに認証付きのProxyが使えません — Tanaka Akira <akr@...> 2011/02/11

2011年2月11日12:59 あつし よしだ <[email protected]>:

[#43203] [Ruby 1.9-Bug#4397][Open] test-mkmf fails due to compilation errors — Shyouhei Urabe <redmine@...>

Bug #4397: test-mkmf fails due to compilation errors

10 messages 2011/02/14

[#43272] [Ruby 1.9 - Bug #4443] [Open] odd evaluation order in a multiple assignment — Yusuke Endoh <mame@...>

13 messages 2011/02/24

[#43274] [Ruby 1.9 - Bug #4445] [Open] ext/openssl の verify_callback が rb_protect で保護されていない — Ippei Obayashi <ohai@...>

13 messages 2011/02/24

[#43276] iseq_compile_each()でのマジックナンバ — きたざわけんいち <peisunstar@...>

きたざわです。

15 messages 2011/02/27
[#43303] Re: iseq_compile_each()でのマジックナンバ — nagachika <nagachika00@...> 2011/03/04

近永と申します。

[#43304] Re: iseq_compile_each()でのマジックナンバ — Yusuke ENDOH <mame@...> 2011/03/04

遠藤です。

[ruby-dev:43170] [Ruby 1.9-Bug#4366][Open] UTF-8文字列に対しての部分文字列取得操作で結果にゴミがつくことがある

From: Motohiro KOSAKI <redmine@...>
Date: 2011-02-04 03:11:46 UTC
List: ruby-dev #43170
Bug #4366: UTF-8文字列に対しての部分文字列取得操作で結果にゴミがつくことがある
http://redmine.ruby-lang.org/issues/show/4366

起票者: Motohiro KOSAKI
ステータス: Open, 優先度: Normal
カテゴリ: core, Target version: 1.9.2
ruby -v: ruby 1.9.3dev (2011-02-04 trunk 30761) [x86_64-linux]

test.rb
-----------------------------------
# coding: utf-8

str="あいうえお"

p str[2,17]
-----------------------------------

結果

%  ./ruby -v test.rb
ruby 1.9.3dev (2011-02-04 trunk 30761) [x86_64-linux]
"うえお\u0000"

で、考察なんですが、

static char *
str_utf8_nth(const char *p, const char *e, long *nthp)
{
    long nth = *nthp;

    if ((int)SIZEOF_VALUE < e - p && (int)SIZEOF_VALUE * 2 < nth) {

                ↑ e-pつまり文字列長の判定がsizeof(VALUE)*2ではなくsizeof(VALUE) (1)

        do {
            nth -= count_utf8_lead_bytes_with_word(s);
            s++;
        } while (s < t && (int)sizeof(VALUE) <= nth);

                 ↑ここがwhileではなくdoループ (2)

なので(1)によりs==tがありえて、その場合(2)により文字列外にたいして
count_utf8_lead_bytes_with_word()呼んじゃってるようです。


----------------------------------------
http://redmine.ruby-lang.org

In This Thread

Prev Next