Uploaded image for project: 'Qpid Dispatch'
  1. Qpid Dispatch
  2. DISPATCH-1900

qd_calloc: Assertion `nmemb && size' failed.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.15.0
    • 1.15.0
    • None
    • None

    Description

      https://travis-ci.com/github/apache/qpid-dispatch/jobs/463197009#L3501

      30: Router QDR.C output file:
      30: >>>>
      30: 2020-12-20 11:19:09.485416 +0000 AGENT (warning) Attribute 'saslConfigPath' of entity 'router' has been deprecated. Use 'saslConfigDir' instead
      30: qdrouterd: /home/travis/build/apache/qpid-dispatch/include/qpid/dispatch/ctools.h:239: qd_calloc: Assertion `nmemb && size' failed.
      30: 
      

      This is probably a mistaken assertion, because calloc is OK with zeros in arguments. From the man page:

             The  calloc() function allocates memory for an array of nmemb elements of size bytes each and re‐
             turns a pointer to the allocated memory.  The memory is set to zero.  If nmemb or size is 0, then
             calloc()  returns either NULL, or a unique pointer value that can later be successfully passed to
             free().  If the multiplication of nmemb and size would result in integer overflow, then  calloc()
             returns  an  error.  By contrast, an integer overflow would not be detected in the following call
             to malloc(), with the result that an incorrectly sized block of memory would be allocated:
      
                 malloc(nmemb * size);
      
      
          int n = qd_server->thread_count - 1; /* Start count-1 threads + use current thread */
          sys_thread_t **threads = (sys_thread_t **)qd_calloc(n, sizeof(sys_thread_t*));
          for (i = 0; i < n; i++) {
              threads[i] = sys_thread(thread_run, qd_server);
          }
      

      Caused by https://github.com/apache/qpid-dispatch/pull/948; I missed the fact it is adding these new failures under Debug build.

      Attachments

        Activity

          People

            jdanek Jiri Daněk
            jdanek Jiri Daněk
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: