Exception: PNGlitch::DataSizeError
- Inherits:
-
StandardError
- Object
- StandardError
- PNGlitch::DataSizeError
- Defined in:
- lib/pnglitch/errors.rb
Instance Method Summary collapse
-
#initialize(filename, over, expected) ⇒ DataSizeError
constructor
A new instance of DataSizeError.
Constructor Details
#initialize(filename, over, expected) ⇒ DataSizeError
Returns a new instance of DataSizeError.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/pnglitch/errors.rb', line 4 def initialize filename, over, expected over_size = digit_format over expected_size = digit_format expected = <<-EOL.gsub(/^\s*/, '') The size of your data goes over #{over_size}. It should be #{expected_size} actually when it's a normal formatted PNG file. PNGlitch raised this error to avoid the attack known as "zip bomb". If you are sure that the PNG image is safe, please set manually your own upper size limit as the variable of PNGlitch#open. EOL = ["\e[31m", , "\e[0m"].join if STDOUT.tty? # color red = [ 'Size of the decompressed data is too large - ', filename, "\n\n", , "\n" ].join super end |