Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-61001

malloc_usable_size should not be called with pointer from new

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • Morpheus
    • Morpheus
    • storage-engine
    • None
    • Untriaged
    • 0
    • Unknown

    Description

      maloc_usable_size should be used to get the size of the underlying allocation returned from "malloc with friends". There is no guarantee that it would work with a pointer returned from the new operator (according to various searches it is "undefined')

       

      "Note that applying malloc_usable_size (or _msize) to the result of new is undefined behavior." (https://stackoverflow.com/questions/54783860/getting-size-of-dynamic-c-style-array-vs-use-of-delete-contradiction 

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            scott.lashley Scott Lashley (Inactive)
            trond Trond Norbye
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty