# OpenSSL::Random.random\_bytes(Object.new)

**URL:** <https://www.ruby-forum.com/t/openssl-random-random-bytes-object-new/138983>\
**Category:** Development\
**Created:** [May 29, 2008, 6:56pm UTC](https://www.ruby-forum.com/t/openssl-random-random-bytes-object-new/138983 "2008-05-29T18:56:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tanaka\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c67d28/32.png) [@Tanaka\_A](https://www.ruby-forum.com/u/Tanaka_A)\
**Post date:** [May 29, 2008, 6:56pm UTC](https://www.ruby-forum.com/t/openssl-random-random-bytes-object-new/138983/1 "2008-05-29T18:56:30Z")

</div>

e$B0J2\<$N$h$&$K!"e(B OpenSSL::Random.random\_bytes(Object.new) e$B$Ge(B  
negative string size (or size too big) (ArgumentError)  
e$B$H$$$&Nc30$K$J$k$N$OJQ$J$N$G$O$J$$$G$7$g$&$+!#e(B

% ./ruby -ropenssl -ve ‘p OpenSSL::Random.random\_bytes(Object.new)’  
ruby 1.8.7 (2008-05-28 patchlevel 5000) [i686-linux]  
-e:1:in `random\_bytes’: negative string size (or size too big)  
(ArgumentError)  
from -e:1

---

<div class="post-metadata">

**Author:** ![Tanaka\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c67d28/32.png) [@Tanaka\_A](https://www.ruby-forum.com/u/Tanaka_A)\
**Post date:** [May 29, 2008, 7:49pm UTC](https://www.ruby-forum.com/t/openssl-random-random-bytes-object-new/138983/2 "2008-05-29T19:49:31Z")

</div>

At Fri, 30 May 2008 01:55:43 +0900,  
Tanaka A. wrote:

> ä»¥ä¸‹ã®ã‚ˆã†ã«ã€ OpenSSL::Random.random\_bytes(Object.new) ã§  
> negative string size (or size too big) (ArgumentError)  
> ã¨ã„ã†ä¾‹å¤–ã«ãªã‚‹ã®ã¯å¤‰ãªã®ã§ã¯ãªã„ã§ã—ã‚‡ã†ã‹ã€‚
> 
> % ./ruby -ropenssl -ve ‘p OpenSSL::Random.random\_bytes(Object.new)’  
> ruby 1.8.7 (2008-05-28 patchlevel 5000) [i686-linux]  
> -e:1:in `random\_bytes’: negative string size (or size too big) (ArgumentError)  
> from -e:1

ã€€FIXNUM\_P()ã§ãƒã‚§ãƒƒã‚¯ã›ãšã«FIX2INT()ã—ã¦ã„ã‚‹ã®ãŒå•é¡Œã§ã—ãŸã€‚  
ã»ã‹ã«ã‚‚ã„ãã¤ã‹ã‚ã£ãŸã®ã§ä½µã›ã¦ç›´ã—ã¾ã—ãŸã€‚
