Bug: unpack+pack with Bignum/Fixnum conflict (ruby 1.8.1)

K

Kero

Hi,

Receiving a binary 32-bits unsigned integer over a socket, I unpack it,
and later on pack to send back.

This works fine with ruby 1.8.0, but I got a RangeError stating the Bignum
is too big to be converted to `int'. We're talking high values here, the
one I saw where it went wrong was above 3 billion.

I would suggest adding a couple of checks to the testsuite:
- [MAXINT].pack("i") => should work
- [MAXINT+1].pack("i") => RangeError
and the same for unsigned flavours, shorts, longs, chars.

Bye,
Kero.

+--- Kero ----------------------- kero@chello@nl ---+
| all the meaningless and empty words I spoke |
| Promises -- The Cranberries |
+--- M38c --- http://httpd.chello.nl/k.vangelder ---+
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,967
Messages
2,570,148
Members
46,694
Latest member
LetaCadwal

Latest Threads

Top