[ruby-dev:50267] [Ruby trunk Bug#13953] gdbm が SHARABLE_MIDDLE_SUBSTRING=1 を考慮していない

From: tommy@...
Date: 2017-09-30 04:37:27 UTC
List: ruby-dev #50267
Issue #13953 has been reported by tommy (Masahiro Tomita).

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

* Author: tommy (Masahiro Tomita)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.5.0dev (2017-09-29 trunk 60062) [x86_64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
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/

In This Thread

Prev Next