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

BSON::OrderedHash can be corrupted

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Critical - P2
    • Resolution: Fixed
    • 1.3.1
    • 1.4.0
    • None
    • ruby 1.8.7 on linux
    • Fully Compatible

    Description

      BSON::OrderedHash can be corrupted

      steps to reproduce:
      execute the following lines:

      a = BSON::OrderedHash.new
      a[:b] = :c
      a.replace(:c => :d)

      results

      a is corrupted. For instance it inspects as:

      {"b"=>nil}

      instead of:
      {:c => :d}

      the method 'replace' on Hash is not overridden !!!!!!!

      implementation suggestion:

      def replace(other_hash)
      @ordered_keys.replace(other_hash.keys)
      super
      end

      Attachments

        Activity

          People

            kbanker Kyle Banker
            thoran Frédéric De Jaeger
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: