Project

General

Profile

Actions

Bug #12915

closed

1..nil can be created by Marshal.load

Added by shugo (Shugo Maeda) almost 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
[ruby-core:78067]

Description

1..nil can be created by Marshal.load as mame san stated on Twitter (https://twitter.com/mametter/status/796372577031622656):

lexington:ruby$ ./ruby -ve 'p 1..nil'
ruby 2.4.0dev (2016-11-10 trunk 56682) [x86_64-linux]
-e:1:in `<main>': bad value for range (ArgumentError)
lexington:ruby$ ./ruby -ve 'p Marshal.load("\x04\bo:\nRange\b:\texclF:\nbegini\x06:\bend0")'
ruby 2.4.0dev (2016-11-10 trunk 56682) [x86_64-linux]
1..nil

Is it intentional behavior (e.g., for compatibility with old versions of Ruby, where 1..nil is allowed)?


Related issues

Related to Ruby master - Feature #12912: An endless range `(1..)`ClosedActions
Related to Ruby master - Bug #12918: (1/nil) can be created by Marshal.loadClosedActions
Actions #1

Updated by mame (Yusuke Endoh) almost 5 years ago

Actions #2

Updated by shugo (Shugo Maeda) almost 5 years ago

  • Related to Bug #12918: (1/nil) can be created by Marshal.load added
Actions #3

Updated by nobu (Nobuyoshi Nakada) almost 5 years ago

  • Status changed from Assigned to Closed

Applied in changeset r56703.


range.c: check loading

  • range.c (range_loader): check loading values if the data came from an initialized range object. [ruby-core:78067] [Bug #12915]
Actions

Also available in: Atom PDF