From: "drbrain (Eric Hodel)" Date: 2013-09-05T09:47:52+09:00 Subject: [ruby-core:57030] [ruby-trunk - Bug #8865] OptionParser acceptable bugs 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 -- http://bugs.ruby-lang.org/