You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ken Cheung <ms...@gmail.com> on 2012/06/14 09:05:03 UTC

[users@httpd] Potential Bug in mpm_common.c

I observed a code clone in the following files. In the function ap_mpm_set_max_mem_free the variable "value" has to be multiplied by 1024 before exit while ap_mpm_set_thread_stacksize does not perform this operation. I wonder if this is necessary. Hope it helps.

function : ap_mpm_set_max_mem_free @ (file: "httpd-2.4.2/server/mpm_common.c", line: 376)~388
    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
    if (err != NULL) {
        return err;
    }

    value = strtol(arg, NULL, 10);
    if (value < 0 || errno == ERANGE)
        return apr_pstrcat(cmd->pool, "Invalid MaxMemFree value: ",
                           arg, NULL);

    ap_max_mem_free = (apr_uint32_t)value * 1024;

    return NULL;

function : ap_mpm_set_thread_stacksize @ (file: "httpd-2.4.2/server/mpm_common.c", line: 395)~407
    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
    if (err != NULL) {
        return err;
    }

    value = strtol(arg, NULL, 10);
    if (value < 0 || errno == ERANGE)
        return apr_pstrcat(cmd->pool, "Invalid ThreadStackSize value: ",
                           arg, NULL);

    ap_thread_stacksize = (apr_size_t)value;

    return NULL;

Re: [users@httpd] Potential Bug in mpm_common.c

Posted by Lazy <la...@gmail.com>.
2012/6/14 Ken Cheung <ms...@gmail.com>:
> I observed a code clone in the following files. In the
> function ap_mpm_set_max_mem_free the variable "value" has to be multiplied
> by 1024 before exit while ap_mpm_set_thread_stacksize does not perform this
> operation. I wonder if this is necessary. Hope it helps.

according to http://httpd.apache.org/docs/2.2/mod/mpm_common.html#threadstacksize

MaxMemFree is in KB and ThreadStackSize is in Bytes so the code is correct

-- 
Michal Grzedzicki

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org