Project

General

Profile

Actions

Bug #13953

closed

gdbm が SHARABLE_MIDDLE_SUBSTRING=1 を考慮していない

Added by tommy (Masahiro Tomita) over 6 years ago. Updated about 6 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.0dev (2017-09-29 trunk 60062) [x86_64-linux]
[ruby-dev:50267]

Description

SHARABLE_MIDDLE_SUBSTRING=1 でコンパイルしたRubyで、GDBM.new が指定した文字列ではなく共有元の文字列終端までファイル名として使用してしまいます。

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

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

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. */
Actions #1

Updated by nobu (Nobuyoshi Nakada) over 6 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r60071.


ext: check if null byte is contained

[ruby-dev:50267] [Bug #13953]

Actions #2

Updated by nobu (Nobuyoshi Nakada) over 6 years ago

  • Backport changed from 2.3: UNKNOWN, 2.4: UNKNOWN to 2.3: REQUIRED, 2.4: REQUIRED

Updated by nagachika (Tomoyuki Chikanaga) over 6 years ago

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

ruby_2_4 r61456 merged revision(s) 60071.

Updated by usa (Usaku NAKAMURA) about 6 years ago

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

ruby_2_3 r62140 merged revision(s) 60071.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0