[
https://issues.apache.org/jira/browse/DISPATCH-1900?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17252898#comment-17252898
]
ASF GitHub Bot commented on DISPATCH-1900:
------------------------------------------
ted-ross commented on a change in pull request #965:
URL: https://github.com/apache/qpid-dispatch/pull/965#discussion_r546747778
##########
File path: include/qpid/dispatch/ctools.h
##########
@@ -236,7 +236,6 @@ static inline void *qd_malloc(size_t size)
static inline void *qd_calloc(size_t nmemb, size_t size)
{
- assert(nmemb && size);
void *ptr = calloc(nmemb, size);
if (!ptr) {
Review comment:
The null-pointer check is not valid in this case. The man page for
calloc states that the returned value may or may not be 0 when one of the input
arguments is 0. I strongly suspect that it is non-zero in this case for
Fedora. I would be inclined to leave the assertion in place, since we
shouldn't be calling qd_calloc with either a zero nmemb or a zero size.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> 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
> Priority: Major
>
> 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]