Project

General

Profile

Actions

Bug #13223

closed

`File.join` will segv if File::SEPARATOR and File::Separator are set.

Added by tenderlovemaking (Aaron Patterson) almost 8 years ago. Updated over 7 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.0dev (2017-02-17 trunk 57648) [x86_64-darwin16]
[ruby-core:79579]

Description

The program below will crash with a segv:

File.const_set :Separator, "hello"
File.const_set :SEPARATOR, "hello"

GC.start

File.join "hello", "world"

This is because the separator object is referenced from a global variable and setting the constants allows the object to be GC'd and the global will go bad.

I've attached a patch that contains a test to demonstrate the problem along with a fix.


Files

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0