Jiri Daněk created DISPATCH-1900:
------------------------------------

             Summary: qd_calloc: Assertion `nmemb && size' failed.
                 Key: DISPATCH-1900
                 URL: https://issues.apache.org/jira/browse/DISPATCH-1900
             Project: Qpid Dispatch
          Issue Type: Bug
    Affects Versions: 1.15.0
            Reporter: Jiri Daněk


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

{noformat}
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: 
{noformat}

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

{code}
       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);

{code}

{code}
    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);
    }
{code}

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



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to