rapid crashes on bignum
Reported by Tiago Franco | January 13th, 2009 @ 12:37 AM | in Hobo 1.0 - Final
The rapid library crashes when a user enters a big number in a numeric field.
See attached log file.
Comments and changes to this ticket
-
Tom Locke March 12th, 2009 @ 11:14 AM
- Milestone set to Hobo 1.0 - Final
- State changed from new to open
-
Bryan Larsen April 6th, 2009 @ 07:49 PM
- Tag changed from crash, rapid to defect, rapid
this bug is quite difficult to trigger, but here's the trick.
Ruby's Fixnum (at least on my machine) is an 8 byte integer. The largest integer available in (sqlite,mysql,postgresql) is an 8 byte integer. To store a larger integer, you need to use a decimal type, which maps onto ruby's BigDecimal.
So it seems impossible to get back a Bignum. But it is possible. If you round trip 777777777777777777 through the database, it comes back as a Bignum, which hobofields & rapid currently do not support.
Most things seem to work if you replace Fixnum with Integer on line 21 of hobo_fields.rb. I'll do more testing.
-
Tiago Franco April 6th, 2009 @ 08:45 PM
Hi,
This bug was detected as followed:
1 - Create a model with an Integer field(i.e. maximum_memberships :integer, :null => false). 2 - Insert a large number in the create form (i.e. 77777777777777777777777777). 3 - The exception is thrown
The main problem is with the integer input field (it accepts a large number).
This was detected in a previous version, after that I made a custom tag for integer field.
Regards, TF
-
Bryan Larsen April 9th, 2009 @ 12:32 PM
- Tag changed from defect, rapid to defect, hobofields, rapid
- Assigned user set to Bryan Larsen
this bug is quite difficult to trigger, but here's the trick.
Ruby's Fixnum (at least on my machine) is an 8 byte integer. The largest integer available in (sqlite,mysql,postgresql) is an 8 byte integer. To store a larger integer, you need to use a decimal type, which maps onto ruby's BigDecimal.
So it seems impossible to get back a Bignum. But it is possible. If you round trip 777777777777777777 through the database, it comes back as a Bignum, which hobofields & rapid currently do not support.
Most things seem to work if you replace Fixnum with Integer on line 21 of hobo_fields.rb. I'll do more testing.
-
Bryan Larsen April 10th, 2009 @ 01:13 AM
- State changed from open to resolved
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป