Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-6462

stack overflow when comparing deeply nested bson objects

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Gone away
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Indexing, Security, Stability
    • Labels:
      None

      Description

      Observed behavior: When mongod compares two deeply nested objects, a stack overflow is triggered. The following example triggers a stack overflow on osx 10.7.4 with both debug and release builds:

      t = db.t;
      t.drop();
       
      function makeNestObj(depth){
          toret = { a : 1};
       
          for(i = 1; i < depth; i++){
              toret = {a : toret};
          }
       
          return toret;
      }
       
      nestedObj = makeNestObj(1500);
       
      // Save two deeply recursive 'a' values, so we can sort them.                               
      t.insert( { a:nestedObj }, true );
      t.insert( { a:nestedObj }, true );
       
      t.find().sort( { a:1 } ).itcount(); // In memory sort triggers a stack overflow.
       
      t.ensureIndex( { a:1 } ); // External sorter triggers a stack overflow.                     

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: