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

BSON::OrderedHash can be corrupted

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical - P2
    • Resolution: Fixed
    • Affects Version/s: 1.3.1
    • Fix Version/s: 1.4.0
    • Component/s: None
    • Labels:
    • Environment:
      ruby 1.8.7 on linux
    • Backwards Compatibility:
      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

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: