ruby-dev (Japanese) list archive (unofficial mirror)
 help / color / mirror / Atom feed
From: nagachika00@gmail•com
To: ruby-dev@ruby-lang.org
Subject: [ruby-dev:50385] [Ruby trunk Bug#13953] gdbm が SHARABLE_MIDDLE_SUBSTRING=1 を考慮していない
Date: Sun, 24 Dec 2017 20:06:41 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-68628.20171224200640.570d10b58ce6b63a@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-13953.20170930043726@ruby-lang.org

Issue #13953 has been updated by nagachika (Tomoyuki Chikanaga).

Backport changed from 2.3: REQUIRED, 2.4: REQUIRED to 2.3: REQUIRED, 2.4: DONE

ruby_2_4 r61456 merged revision(s) 60071.

----------------------------------------
Bug #13953: gdbm が SHARABLE_MIDDLE_SUBSTRING=1 を考慮していない
https://bugs.ruby-lang.org/issues/13953#change-68628

* Author: tommy (Masahiro Tomita)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.5.0dev (2017-09-29 trunk 60062) [x86_64-linux]
* Backport: 2.3: REQUIRED, 2.4: DONE
----------------------------------------
SHARABLE_MIDDLE_SUBSTRING=1 でコンパイルしたRubyで、GDBM.new が指定した文字列ではなく共有元の文字列終端までファイル名として使用してしまいます。

~~~
% ruby -rgdbm -e 'GDBM.new(("0123456789"*10)[0,24])'
% ls
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
~~~

次のパッチで直ると思います。

~~~ diff
diff --git a/ext/gdbm/gdbm.c b/ext/gdbm/gdbm.c
index 709f466cd8..cbf96c29f9 100644
--- a/ext/gdbm/gdbm.c
+++ b/ext/gdbm/gdbm.c
@@ -228,7 +228,7 @@ fgdbm_initialize(int argc, VALUE *argv, VALUE obj)
     if (!NIL_P(vflags))
         flags = NUM2INT(vflags);
 
-    SafeStringValue(file);
+    FilePathValue(file);
 
 #ifdef GDBM_CLOEXEC
     /* GDBM_CLOEXEC is available since gdbm 1.10. */
~~~




-- 
https://bugs.ruby-lang.org/

  parent reply	other threads:[~2017-12-24 20:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-13953.20170930043726@ruby-lang.org>
2017-09-30  4:37 ` [ruby-dev:50267] [Ruby trunk Bug#13953] gdbm が SHARABLE_MIDDLE_SUBSTRING=1 を考慮していない tommy
2017-12-24 20:06 ` nagachika00 [this message]
2018-01-31 13:39 ` [ruby-dev:50456] " usa

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-list from there: mbox

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

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

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

  git send-email \
    --in-reply-to=redmine.journal-68628.20171224200640.570d10b58ce6b63a@ruby-lang.org \
    --to=ruby-dev@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).