Package: libbarby-ruby1.8 Version: 0.3-1 Severity: normal Tags: patch
Creating a new instance of Barby::Code128 with a legitimate string can cause a stack trace. One such string is the empty string: Barby::Code128.new("", 'B') The stack trace is: /usr/lib/ruby/1.8/barby/barcode/code_128.rb:239:in `characters': private method `split' called for nil:NilClass (NoMethodError) from /usr/lib/ruby/1.8/barby/barcode/code_128.rb:364:in `valid?' from /usr/lib/ruby/1.8/barby/barcode/code_128.rb:162:in `initialize' from ./foo.rb:15:in `new' from ./foo.rb:15 foo.rb (attached) reproduces the problem two different ways. Wayne Conrad -- System Information: Debian Release: squeeze/sid APT prefers testing APT policy: (500, 'testing') Architecture: i386 (i686) Kernel: Linux 2.6.30-2-686-bigmem (SMP w/4 CPU cores) Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) Shell: /bin/sh linked to /bin/bash Versions of packages libbarby-ruby1.8 depends on: ii librqrcode-ruby1.8 0.3.2-2 Ruby library for encoding QRCode ( ii rails 2.2.3-1 MVC ruby based framework geared fo ii ruby1.8 1.8.7.174-2 Interpreter of object-oriented scr libbarby-ruby1.8 recommends no packages. Versions of packages libbarby-ruby1.8 suggests: ii libcairo-ruby1.8 1.8.0-1 Cairo bindings for the Ruby langua pn libprawn-ruby1.8 <none> (no description available) ii librmagick-ruby1.8 2.11.1-1 ImageMagick API for Ruby 1.8 -- no debconf information
foo.rb
Description: application/ruby
diff -ur libbarby-ruby-0.3.orig/lib/barby/barcode/code_128.rb libbarby-ruby-0.3/lib/barby/barcode/code_128.rb --- libbarby-ruby-0.3.orig/lib/barby/barcode/code_128.rb 2009-11-18 17:51:28.000000000 -0700 +++ libbarby-ruby-0.3/lib/barby/barcode/code_128.rb 2009-11-18 17:51:37.000000000 -0700 @@ -227,8 +227,8 @@ #sets, in which case the extra will itself have an extra. def extra=(extra) raise ArgumentError, "Extra must begin with \\301, \\302 or \\303" unless extra =~ /^[#{CODEA+CODEB+CODEC}]/n - type = extra[/([#{CODEA+CODEB+CODEC}])/n, 1] - data = extra[/[#{CODEA+CODEB+CODEC}](.*)/n, 1] + type = extra[0..0] + data = extra[1..-1] @extra = class_for(type).new(data) end