Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-1039

RangeError in bson_int32? with large numbers

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: bson-3.2.4
    • Fix Version/s: 12_01_17
    • Component/s: BSON
    • Labels:
    • Environment:
      Linux debian-jessie 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u3 (2015-08-04) x86_64 GNU/Linux
    • Backwards Compatibility:
      Fully Compatible

      Description

      Using `bson_int32?` on an adequately large number crashes with a RangeError.

      ```
      irb(main):001:0> require 'bson'
      => true
      irb(main):002:0> 9237164310713597997.bson_int32?
      RangeError: bignum too big to convert into `long'
      from (irb):2:in `bson_int32?'
      from (irb):2
      from /usr/local/rbenv/versions/2.2.3/bin/irb:11:in `<main>'
      ```

      As a stopgap solution, I'm using Strings to store these numbers instead, but it's highly space-inefficient.

        Attachments

          Activity

            People

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            uppfinnarn uppfinnarn
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: