loading
open in
main.rb
1
2
3
4
5
6
7
8
9
10
11
good_header = "ABCDEFGHIJKLMNOPQRST"
good_header.force_encoding('ASCII-8BIT')
bad_header = "ABCDEFGHIJKLMNOP\x93\x92JO"
bad_header.force_encoding('ASCII-8BIT')
puts "Header Sizes: #{good_header.size}, #{bad_header.size}"
good_input = good_header + "!!!!!!!!!!"
bad_input = bad_header + "!!!!!!!!!!"
regex = Regexp.new('(?<=.{20})(.+)', Regexp::NOENCODING)

puts "Good: #{good_input.match regex}"
puts "Bad: #{bad_input.match regex}"
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]