Forum: Ruby-core [ruby-trunk - Bug #8865][Assigned] OptionParser acceptable bugs

58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 drbrain (Eric Hodel) (Guest)
on 2013-09-04 23:00
(Received via mailing list)
Issue #8865 has been reported by drbrain (Eric Hodel).

----------------------------------------
Bug #8865: OptionParser acceptable bugs
https://bugs.ruby-lang.org/issues/8865

Author: drbrain (Eric Hodel)
Status: Assigned
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: lib
Target version:
ruby -v: -
Backport: 1.9.3: REQUIRED, 2.0.0: REQUIRED


I have found a few bugs in OptionParser's accept feature:

Hexadecimal and binary numbers are not properly supported for Integer

OptionParser::DecimalInteger, OptionParser::OctalInteger and
OptionParser::DecimalNumeric convert invalid input to 0 or nil instead
of raising InvalidArgument.

The attached patch fixes the validation regular expression for handling
binary and hexadecimal arguments and adds verification for
DecimalInteger, OctalInteger and DecimalNumeric
58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 drbrain (Eric Hodel) (Guest)
on 2013-09-05 02:21
(Received via mailing list)
Issue #8865 has been updated by drbrain (Eric Hodel).

File optparse.rb.accept.2.patch added

Updated with patch 2 that includes tests
----------------------------------------
Bug #8865: OptionParser acceptable bugs
https://bugs.ruby-lang.org/issues/8865#change-41624

Author: drbrain (Eric Hodel)
Status: Assigned
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: lib
Target version:
ruby -v: -
Backport: 1.9.3: REQUIRED, 2.0.0: REQUIRED


I have found a few bugs in OptionParser's accept feature:

Hexadecimal and binary numbers are not properly supported for Integer

OptionParser::DecimalInteger, OptionParser::OctalInteger and
OptionParser::DecimalNumeric convert invalid input to 0 or nil instead
of raising InvalidArgument.

The attached patch fixes the validation regular expression for handling
binary and hexadecimal arguments and adds verification for
DecimalInteger, OctalInteger and DecimalNumeric
58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 drbrain (Eric Hodel) (Guest)
on 2013-09-05 02:48
(Received via mailing list)
Issue #8865 has been updated by drbrain (Eric Hodel).

File optparse.rb.accept.3.patch added

Here is patch 3 that uses end-of-string anchoring to ensure the entire
number is bad.
----------------------------------------
Bug #8865: OptionParser acceptable bugs
https://bugs.ruby-lang.org/issues/8865#change-41625

Author: drbrain (Eric Hodel)
Status: Assigned
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: lib
Target version:
ruby -v: -
Backport: 1.9.3: REQUIRED, 2.0.0: REQUIRED


I have found a few bugs in OptionParser's accept feature:

Hexadecimal and binary numbers are not properly supported for Integer

OptionParser::DecimalInteger, OptionParser::OctalInteger and
OptionParser::DecimalNumeric convert invalid input to 0 or nil instead
of raising InvalidArgument.

The attached patch fixes the validation regular expression for handling
binary and hexadecimal arguments and adds verification for
DecimalInteger, OctalInteger and DecimalNumeric
58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 drbrain (Eric Hodel) (Guest)
on 2013-09-05 06:31
(Received via mailing list)
Issue #8865 has been updated by drbrain (Eric Hodel).

Assignee changed from nobu (Nobuyoshi Nakada) to drbrain (Eric Hodel)

From #ruby-core IRC:

19:46 nokada: drbrain: seems fine, and add tests 1234xyz fails, plz

----------------------------------------
Bug #8865: OptionParser acceptable bugs
https://bugs.ruby-lang.org/issues/8865#change-41631

Author: drbrain (Eric Hodel)
Status: Assigned
Priority: Normal
Assignee: drbrain (Eric Hodel)
Category: lib
Target version:
ruby -v: -
Backport: 1.9.3: REQUIRED, 2.0.0: REQUIRED


I have found a few bugs in OptionParser's accept feature:

Hexadecimal and binary numbers are not properly supported for Integer

OptionParser::DecimalInteger, OptionParser::OctalInteger and
OptionParser::DecimalNumeric convert invalid input to 0 or nil instead
of raising InvalidArgument.

The attached patch fixes the validation regular expression for handling
binary and hexadecimal arguments and adds verification for
DecimalInteger, OctalInteger and DecimalNumeric
8cbb39dadafaf2287a83a13ee4981ec9?d=identicon&s=25 unknown (Guest)
on 2014-02-14 05:52
(Received via mailing list)
Issue #8865 has been updated by Usaku NAKAMURA.

Backport changed from 1.9.3: REQUIRED, 2.0.0: REQUIRED to 1.9.3: DONE,
2.0.0: REQUIRED

backported into ruby_1_9_3 at r44935.

----------------------------------------
Bug #8865: OptionParser acceptable bugs
https://bugs.ruby-lang.org/issues/8865#change-45123

* Author: Eric Hodel
* Status: Closed
* Priority: Normal
* Assignee: Eric Hodel
* Category: lib
* Target version:
* ruby -v: -
* Backport: 1.9.3: DONE, 2.0.0: REQUIRED
----------------------------------------
I have found a few bugs in OptionParser's accept feature:

Hexadecimal and binary numbers are not properly supported for Integer

OptionParser::DecimalInteger, OptionParser::OctalInteger and
OptionParser::DecimalNumeric convert invalid input to 0 or nil instead
of raising InvalidArgument.

The attached patch fixes the validation regular expression for handling
binary and hexadecimal arguments and adds verification for
DecimalInteger, OctalInteger and DecimalNumeric

---Files--------------------------------
optparse.rb.accept.patch (1.63 KB)
optparse.rb.accept.2.patch (6.85 KB)
optparse.rb.accept.3.patch (7.77 KB)
5cf8f058a4c094bb708174fb43e7a387?d=identicon&s=25 unknown (Guest)
on 2014-02-19 17:39
(Received via mailing list)
Issue #8865 has been updated by Tomoyuki Chikanaga.

Backport changed from 1.9.3: DONE, 2.0.0: REQUIRED to 1.9.3: DONE,
2.0.0: DONE

r42844 and r42845 were backported to ruby_2_0_0 at r45050.

----------------------------------------
Bug #8865: OptionParser acceptable bugs
https://bugs.ruby-lang.org/issues/8865#change-45282

* Author: Eric Hodel
* Status: Closed
* Priority: Normal
* Assignee: Eric Hodel
* Category: lib
* Target version:
* ruby -v: -
* Backport: 1.9.3: DONE, 2.0.0: DONE
----------------------------------------
I have found a few bugs in OptionParser's accept feature:

Hexadecimal and binary numbers are not properly supported for Integer

OptionParser::DecimalInteger, OptionParser::OctalInteger and
OptionParser::DecimalNumeric convert invalid input to 0 or nil instead
of raising InvalidArgument.

The attached patch fixes the validation regular expression for handling
binary and hexadecimal arguments and adds verification for
DecimalInteger, OctalInteger and DecimalNumeric

---Files--------------------------------
optparse.rb.accept.patch (1.63 KB)
optparse.rb.accept.2.patch (6.85 KB)
optparse.rb.accept.3.patch (7.77 KB)
This topic is locked and can not be replied to.