Fix unchecked returns of bson initializers

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • 🔵 Done
    • C Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Some returns to bson_iter_init_from_data_at_offset are unchecked: example.

      This may result in iteration quietly failing and reporting and end-iterator on bad data:

      // Document is 12 bytes { 'x': 1}. Buffer is 13 bytes (extra 0xFF).
      std::uint8_t const data[] = {12, 0, 0, 0, 16, 'x', '\0', 1, 0, 0, 0, 0, 0xFF};
      auto v = bsoncxx::v_noabi::document::view(data, sizeof(data));
      REQUIRE(v.begin() == v.end()); // No error indicated!?
      

      See comment for additional conversation.

            Assignee:
            Unassigned
            Reporter:
            Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: