[ruby-core:67044] [ruby-trunk - Bug #10633] OpenSSL RangeError on update

From: dannyguinther@...
Date: 2014-12-22 21:53:14 UTC
List: ruby-core #67044
Issue #10633 has been updated by Danny Guinther.


I get the same result on

ruby 1.9.2p330 (2014-08-07 revision 47094) [x86_64-linux]
ruby 1.9.3p545 (2014-02-24 revision 45159) [x86_64-linux]
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]

Maybe an Ubuntu OpenSSL issue? Either that or the issue has been around for a while.

OpenSSL Version: 1.0.1f-1ubuntu2.7

----------------------------------------
Bug #10633: OpenSSL RangeError on update
https://bugs.ruby-lang.org/issues/10633#change-50564

* Author: Kenneth Hoffmann
* Status: Open
* Priority: Normal
* Assignee: openssl
* Category: ext/openssl
* Target version: current: 2.2.0
* ruby -v: 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
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.

`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)`

Running this will return:

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

File generated with dd:

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




-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next