Project

General

Profile

Bug #10633

Updated by nobu (Nobuyoshi Nakada) almost 10 years ago

OpenSSL Cipher throws a RangeError on the update function when given a very large string. I've verified that it happens with a file of 2 or 3GB in size. 1 GB works fine. This has been tested with 2.1.2, 2.1.3, and 2.2rc-1. 

 ```ruby 
 require `require 'openssl' 
 cipher = OpenSSL::Cipher::Cipher.new('aes-256-cbc') 
 cipher.decrypt 
 cipher.iv = "fooooooooooooooooooooooooooooooooo" 
 cipher.key = "barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr" 
 f = File.open("<path to a 2 GB file generated with dd>", "r") 
 contents = f.read; 
 cipher.update(contents) 
 ``` cipher.update(contents)` 

 Running this will return: 

 ``` 
 RangeError: `RangeError: integer 2147483648 too big to convert to `int' 
 ``` `int'` 

 File generated with dd: 

 ``` 
 dd `dd if=/dev/zero of=2g.img bs=1 count=0 seek=2G 
 ``` 
 seek=2G`  

Back