From: "mame (Yusuke Endoh)" Date: 2012-03-27T02:46:19+09:00 Subject: [ruby-core:43708] [ruby-trunk - Feature #5219][Assigned] Array#pack should warn (or raise) if an invalid pack string is given Issue #5219 has been updated by mame (Yusuke Endoh). Status changed from Open to Assigned Assignee set to drbrain (Eric Hodel) drbrain, > Ruby should at least warn like printf when -w is active: Agreed. Could you offer a patch? I think you can commit it, unless there is objection. -- Yusuke Endoh ---------------------------------------- Feature #5219: Array#pack should warn (or raise) if an invalid pack string is given https://bugs.ruby-lang.org/issues/5219#change-25209 Author: drbrain (Eric Hodel) Status: Assigned Priority: Normal Assignee: drbrain (Eric Hodel) Category: core Target version: 2.0.0 If garbage characters are inserted into the pack string ruby ignores them: $ ruby19 -e 'p [1, 2, 3].pack("*N")' "\x00\x00\x00\x01" $ ruby19 -e 'p [1, 2, 3].pack("yN")' "\x00\x00\x00\x01" Ruby should at least warn like printf when -w is active: $ ruby19 -we 'printf "%d %d", 1, 2, 3' -e:1: warning: too many arguments for format string A future version could raise an exception. See also: https://github.com/rubinius/rubinius/issues/1127 -- http://bugs.ruby-lang.org/