Issue #5219 has been updated by drbrain (Eric Hodel).

File pack.c.warn_on_unknown_directive.patch added

I was helping someone else write a patch, but they have gone missing.

Can you check this patch?
----------------------------------------
Feature #5219: Array#pack should warn (or raise) if an invalid pack string is given
https://bugs.ruby-lang.org/issues/5219#change-25229

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/