Hi, I removed the obvious false-positives from the list.

I'll open tickets by categroy of the errors.


Thank you very much!


Am 15.10.2016 um 17:26 schrieb Dmitry Karasik:
Dear all,

I've had access to a of C/C++ static analysis tool PVS Studio,
and ran it against the latest rakudo sources [1]. The majority of notes seems
to be noise, but there were found some valid concerns (or at least looking
valid to me) f.ex.  this:

    MoarVM/3rdparty/dynasm/dasm_x86.h:125
    realloc() possible leak: when realloc() fails in allocating memory, original
    pointer 'D->lglabels' is lost. Consider assigning realloc() to a temporary
    pointer.

You probably might find it interesting to look at the log

[1] http://karasik.eu.org/misc/pvs/rakudo.log


Viva64-EM
full
8
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/callsite.c
error
V526
The 'memcmp' function returns 0 if corresponding buffers are equal. Consider examining the condition for mistakes.
false
3

    if (num_flags && memcmp(cs1->arg_flags, cs2->arg_flags, num_flags))
        return 0;
------------
Viva64-EM
full
397
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/exceptions.c
error
V576
Incorrect format. Consider checking the fourth actual argument of the 'snprintf' function. The SIGNED integer type argument is expected.
false
3
        char            *line_number = MVM_malloc(16);
        snprintf(line_number, 16, "%d", annot ? annot->line_number : 1);
------------
Viva64-EM
full
588
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/bytecode.c
error
V649
There are two 'if' statements with identical conditional expressions. The first 'if' statement contains function return. This means that the second 'if' statement is senseless. Check lines: 581, 588.
false
2
    /* Ensure no other thread has done this for us in the mean time. */
    if (sf->body.fully_deserialized) {
        MVM_reentrantmutex_unlock(tc, (MVMReentrantMutex *)cu->body.update_mutex);
581,588
------------
Viva64-EM
full
1386
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the fourth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
                                if (dlog) {
                                    fprintf(dlog, "I %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
                                    fflush(dlog);
------------
Viva64-EM
full
1386
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the fifth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
                                if (dlog) {
                                    fprintf(dlog, "I %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
                                    fflush(dlog);
------------
Viva64-EM
full
1386
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the sixth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
                                if (dlog) {
                                    fprintf(dlog, "I %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
                                    fflush(dlog);
------------
Viva64-EM
full
1386
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the seventh actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
                                if (dlog) {
                                    fprintf(dlog, "I %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
                                    fflush(dlog);
------------
Viva64-EM
full
1423
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the fourth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
                                if (dlog) {
                                    fprintf(dlog, "I %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
                                    fflush(dlog);
------------
Viva64-EM
full
1423
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the fifth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
                                if (dlog) {
                                    fprintf(dlog, "I %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
                                    fflush(dlog);
------------
Viva64-EM
full
1423
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the sixth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
                                if (dlog) {
                                    fprintf(dlog, "I %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
                                    fflush(dlog);
------------
Viva64-EM
full
1423
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the seventh actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
                                if (dlog) {
                                    fprintf(dlog, "I %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
                                    fflush(dlog);
------------
Viva64-EM
full
1445
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the fourth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
                if (dlog) {
                    fprintf(dlog, "C %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
                    fflush(dlog);
------------
Viva64-EM
full
1445
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the fifth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
                if (dlog) {
                    fprintf(dlog, "C %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
                    fflush(dlog);
------------
Viva64-EM
full
1445
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the sixth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
                if (dlog) {
                    fprintf(dlog, "C %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
                    fflush(dlog);
------------
Viva64-EM
full
1445
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the seventh actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
                if (dlog) {
                    fprintf(dlog, "C %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
                    fflush(dlog);
------------
Viva64-EM
full
1476
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the fourth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
                if (dlog) {
                    fprintf(dlog, "F %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
                    fflush(dlog);
------------
Viva64-EM
full
1476
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the fifth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
                if (dlog) {
                    fprintf(dlog, "F %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
                    fflush(dlog);
------------
Viva64-EM
full
1476
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the sixth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
                if (dlog) {
                    fprintf(dlog, "F %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
                    fflush(dlog);
------------
Viva64-EM
full
1476
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the seventh actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
                if (dlog) {
                    fprintf(dlog, "F %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
                    fflush(dlog);
------------
Viva64-EM
full
1491
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the fourth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
    if (dlog) {
        fprintf(dlog, "N %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
        fflush(dlog);
------------
Viva64-EM
full
1491
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the fifth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
    if (dlog) {
        fprintf(dlog, "N %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
        fflush(dlog);
------------
Viva64-EM
full
1491
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the sixth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
    if (dlog) {
        fprintf(dlog, "N %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
        fflush(dlog);
------------
Viva64-EM
full
1491
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/frame.c
error
V576
Incorrect format. Consider checking the seventh actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
    if (dlog) {
        fprintf(dlog, "N %s %d %d %d %d %llu %llu %llu\n", c_name, fcost, icost, ecost, xcost, last_time, start_time, uv_hrtime());
        fflush(dlog);
------------
Viva64-EM
full
615
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3

    val->tc        = tc;
    val->cu        = fb->cu;
------------
Viva64-EM
full
616
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
    val->tc        = tc;
    val->cu        = fb->cu;
    val->frame     = static_frame;
------------
Viva64-EM
full
617
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
    val->cu        = fb->cu;
    val->frame     = static_frame;
    val->loc_count = fb->num_locals;
------------
Viva64-EM
full
618
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
    val->frame     = static_frame;
    val->loc_count = fb->num_locals;
    val->loc_types = fb->local_types;
------------
Viva64-EM
full
619
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
    val->loc_count = fb->num_locals;
    val->loc_types = fb->local_types;
    val->bc_size   = fb->bytecode_size;
------------
Viva64-EM
full
620
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
    val->loc_types = fb->local_types;
    val->bc_size   = fb->bytecode_size;
    val->src_cur_op = fb->bytecode;
------------
Viva64-EM
full
621
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
    val->bc_size   = fb->bytecode_size;
    val->src_cur_op = fb->bytecode;
    val->src_bc_end = fb->bytecode + fb->bytecode_size;
------------
Viva64-EM
full
622
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
    val->src_cur_op = fb->bytecode;
    val->src_bc_end = fb->bytecode + fb->bytecode_size;
    val->labels    = MVM_calloc(fb->bytecode_size, 1);
------------
Viva64-EM
full
623
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
    val->src_bc_end = fb->bytecode + fb->bytecode_size;
    val->labels    = MVM_calloc(fb->bytecode_size, 1);
    val->cur_info  = NULL;
------------
Viva64-EM
full
624
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
    val->labels    = MVM_calloc(fb->bytecode_size, 1);
    val->cur_info  = NULL;
    val->cur_mark  = NULL;
------------
Viva64-EM
full
625
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
    val->cur_info  = NULL;
    val->cur_mark  = NULL;
    val->cur_instr = 0;
------------
Viva64-EM
full
626
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
    val->cur_mark  = NULL;
    val->cur_instr = 0;
    val->cur_call  = NULL;
------------
Viva64-EM
full
627
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
    val->cur_instr = 0;
    val->cur_call  = NULL;
    val->cur_arg   = 0;
------------
Viva64-EM
full
628
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
    val->cur_call  = NULL;
    val->cur_arg   = 0;
------------
Viva64-EM
full
630
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3

    val->expected_named_arg    = 0;
    val->remaining_positionals = 0;
------------
Viva64-EM
full
631
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
    val->expected_named_arg    = 0;
    val->remaining_positionals = 0;
    val->remaining_jumplabels  = 0;
------------
Viva64-EM
full
632
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
    val->remaining_positionals = 0;
    val->remaining_jumplabels  = 0;
    val->reg_type_var          = 0;
------------
Viva64-EM
full
633
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
    val->remaining_jumplabels  = 0;
    val->reg_type_var          = 0;
------------
Viva64-EM
full
641
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
#else
    val->bc_start = fb->bytecode;
#endif
------------
Viva64-EM
full
643
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
#endif
    val->bc_end = val->bc_start + fb->bytecode_size;
    val->cur_op = val->bc_start;
------------
Viva64-EM
full
643
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
#endif
    val->bc_end = val->bc_start + fb->bytecode_size;
    val->cur_op = val->bc_start;
------------
Viva64-EM
full
644
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
    val->bc_end = val->bc_start + fb->bytecode_size;
    val->cur_op = val->bc_start;
------------
Viva64-EM
full
644
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
    val->bc_end = val->bc_start + fb->bytecode_size;
    val->cur_op = val->bc_start;
------------
Viva64-EM
full
646
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3

    while (val->cur_op < val->bc_end) {
        read_op(val);
------------
Viva64-EM
full
646
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3

    while (val->cur_op < val->bc_end) {
        read_op(val);
------------
Viva64-EM
full
648
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
        read_op(val);
        if (val->cur_mark && val->cur_mark[0] == 's')
            fail(val, MSG(val, "Illegal appearance of spesh op"));
------------
Viva64-EM
full
648
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
        read_op(val);
        if (val->cur_mark && val->cur_mark[0] == 's')
            fail(val, MSG(val, "Illegal appearance of spesh op"));
------------
Viva64-EM
full
649
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
        if (val->cur_mark && val->cur_mark[0] == 's')
            fail(val, MSG(val, "Illegal appearance of spesh op"));
------------
Viva64-EM
full
649
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
        if (val->cur_mark && val->cur_mark[0] == 's')
            fail(val, MSG(val, "Illegal appearance of spesh op"));
------------
Viva64-EM
full
649
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
        if (val->cur_mark && val->cur_mark[0] == 's')
            fail(val, MSG(val, "Illegal appearance of spesh op"));
------------
Viva64-EM
full
651
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3

        switch (val->cur_mark[0]) {
            case MARK_regular:
------------
Viva64-EM
full
674
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/validation.c
error
V619
The array 'val' is being utilized as a pointer to single object.
false
3
    /* Validation successful. Clear up instruction offsets. */
    MVM_free(val->labels);
}
------------
Viva64-EM
full
94
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/threads.c
error
V575
The null pointer is passed into 'pthread_exit' function. Inspect the first argument.
false
1
    /* Exit the thread, now it's completed. */
    MVM_platform_thread_exit(NULL);
}
------------
Viva64-EM
full
13
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/hll.c
error
V614
Potentially uninitialized pointer 'kdata' used.
false
1
    if (tc->instance->hll_compilee_depth)
        HASH_FIND(hash_handle, tc->instance->compilee_hll_configs, kdata, klen, entry);
    else
------------
Viva64-EM
full
13
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/hll.c
error
V614
Potentially uninitialized variable 'klen' used.
false
2
    if (tc->instance->hll_compilee_depth)
        HASH_FIND(hash_handle, tc->instance->compilee_hll_configs, kdata, klen, entry);
    else
------------
Viva64-EM
full
13
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/core/nativecall_dyncall.c
error
V517
The use of 'if (A) {...} else if (A) {...}' pattern was detected. There is a probability of logical error presence. Check lines: 13, 19.
false
1
            result = DC_CALL_C_X86_CDECL;
        else if (strcmp(cname, "stdcall") == 0)
            result = DC_CALL_C_X86_WIN32_STD;
13,19
------------
Viva64-EM
full
43
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/gc/allocation.c
error
V614
Potentially uninitialized pointer 'allocated' used.
false
1

    return allocated;
}
------------
Viva64-EM
full
190
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/io/io.c
error
V614
Potentially uninitialized pointer 'buf' used.
false
1
    /* Stash the data in the VMArray. */
    ((MVMArray *)result)->body.slots.i8 = (MVMint8 *)buf;
    ((MVMArray *)result)->body.start    = 0;
------------
Viva64-EM
full
192
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/io/io.c
error
V614
Potentially uninitialized variable 'bytes_read' used.
false
2
    ((MVMArray *)result)->body.start    = 0;
    ((MVMArray *)result)->body.ssize    = bytes_read;
    ((MVMArray *)result)->body.elems    = bytes_read;
------------
Viva64-EM
full
59
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/io/syncsocket.c
error
V512
A call of the 'memcpy' function will lead to overflow of the buffer 'dest'.
false
1
            dest = MVM_malloc(sizeof(struct sockaddr_in6));
            memcpy(dest, result->ai_addr, sizeof(struct sockaddr_in6));
        } else {
------------
Viva64-EM
full
59
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/io/syncsocket.c
error
V512
A call of the 'memcpy' function will lead to the 'result->ai_addr' buffer becoming out of range.
false
1
            dest = MVM_malloc(sizeof(struct sockaddr_in6));
            memcpy(dest, result->ai_addr, sizeof(struct sockaddr_in6));
        } else {
------------
Viva64-EM
full
70
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/io/syncsocket.c
error
V614
Potentially uninitialized pointer 'dest' used.
false
1

    return dest;
}
------------
Viva64-EM
full
229
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/io/procops.c
error
V506
Pointer to local variable 'result' is stored outside the scope of this variable. Such a pointer will become invalid.
false
3
        process_still_running = 0;
        process->data = &result;
        uv_ref((uv_handle_t *)process);
------------
Viva64-EM
full
304
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/io/procops.c
error
V506
Pointer to local variable 'result' is stored outside the scope of this variable. Such a pointer will become invalid.
false
3
    else {
        process->data = &result;
        uv_ref((uv_handle_t *)process);
------------
Viva64-EM
full
401
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/6model/containers.c
error
V614
Potentially uninitialized pointer 'kdata' used.
false
1

    HASH_FIND(hash_handle, tc->instance->container_registry, kdata, klen, entry);
------------
Viva64-EM
full
401
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/6model/containers.c
error
V614
Potentially uninitialized variable 'klen' used.
false
2

    HASH_FIND(hash_handle, tc->instance->container_registry, kdata, klen, entry);
------------
Viva64-EM
full
424
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/6model/containers.c
error
V614
Potentially uninitialized pointer 'kdata' used.
false
1

    HASH_FIND(hash_handle, tc->instance->container_registry, kdata, klen, entry);
    return entry != NULL ? entry->configurer : NULL;
------------
Viva64-EM
full
424
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/6model/containers.c
error
V614
Potentially uninitialized variable 'klen' used.
false
2

    HASH_FIND(hash_handle, tc->instance->container_registry, kdata, klen, entry);
    return entry != NULL ? entry->configurer : NULL;
------------
Viva64-EM
full
382
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/6model/serialization.c
error
V634
The priority of the '*' operation is higher than that of the '>>' operation. It's possible that parentheses should be used in the expression.
false
3
        MVMuint8 rest = storage_needed - 1;
        MVMint64 nybble = value >> 8 * rest;
        /* All the other high bits should be the same as the top bit of the
------------
Viva64-EM
full
1572
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/6model/serialization.c
error
V634
The priority of the '*' operation is higher than that of the '<<' operation. It's possible that parentheses should be used in the expression.
false
3
       gets flushed away with the sign extension shifting later.  */
    result = (MVMint64)first << 8 * need;
------------
Viva64-EM
full
1637
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/6model/serialization.c
error
V547
Expression 'len < 0' is always false. Unsigned type value is never < 0.
false
1
        *(reader->cur_read_offset) += len;
    } else if (len < 0) {
        fail_deserialize(tc, reader, "Cannot read a c string with negative length %d.", len);
------------
Viva64-EM
full
268
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/spesh/manipulate.c
error
V591
Non-void function should return a value.
false
2
    ins->prev = NULL;
}
------------
Viva64-EM
full
1179
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/jit/graph.c
error
V729
Function body contains the 'skipdevirt' label that is not used by any 'goto' statements.
false
3

skipdevirt:
------------
Viva64-EM
full
515
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/strings/utf8_c8.c
error
V614
Potentially uninitialized variable 'repl_length' used. Consider checking the seventh actual argument of the 'emit_cp' function.
false
2
        if (g >= 0) {
            emit_cp(tc, g, &result, &result_pos, &result_limit, repl_bytes, repl_length);
        }
------------
Viva64-EM
full
662
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/profiler/heapsnapshot.c
error
V576
Incorrect format. Consider checking the fourth actual argument of the 'snprintf' function. The memsize type argument is expected.
false
1
         char tmp[256];
         size_t item_chars = snprintf(tmp, 256,
            "%"PRIu64",%"PRIu64";",
------------
Viva64-EM
full
662
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/profiler/heapsnapshot.c
error
V576
Incorrect format. Consider checking the fifth actual argument of the 'snprintf' function. The memsize type argument is expected.
false
1
         char tmp[256];
         size_t item_chars = snprintf(tmp, 256,
            "%"PRIu64",%"PRIu64";",
------------
Viva64-EM
full
666
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/profiler/heapsnapshot.c
error
V547
Expression 'item_chars < 0' is always false. Unsigned type value is never < 0.
false
1
            col->types[i].type_name);
         if (item_chars < 0)
             MVM_panic(1, "Failed to save type in heap snapshot");
------------
Viva64-EM
full
696
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/profiler/heapsnapshot.c
error
V576
Incorrect format. Consider checking the fourth actual argument of the 'snprintf' function. The memsize type argument is expected.
false
1
         char tmp[256];
         size_t item_chars = snprintf(tmp, 256,
            "%"PRId64",%"PRId64",%"PRId64",%"PRId64";",
------------
Viva64-EM
full
696
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/profiler/heapsnapshot.c
error
V576
Incorrect format. Consider checking the fifth actual argument of the 'snprintf' function. The memsize type argument is expected.
false
1
         char tmp[256];
         size_t item_chars = snprintf(tmp, 256,
            "%"PRId64",%"PRId64",%"PRId64",%"PRId64";",
------------
Viva64-EM
full
696
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/profiler/heapsnapshot.c
error
V576
Incorrect format. Consider checking the sixth actual argument of the 'snprintf' function. The memsize type argument is expected.
false
1
         char tmp[256];
         size_t item_chars = snprintf(tmp, 256,
            "%"PRId64",%"PRId64",%"PRId64",%"PRId64";",
------------
Viva64-EM
full
696
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/profiler/heapsnapshot.c
error
V576
Incorrect format. Consider checking the seventh actual argument of the 'snprintf' function. The memsize type argument is expected.
false
1
         char tmp[256];
         size_t item_chars = snprintf(tmp, 256,
            "%"PRId64",%"PRId64",%"PRId64",%"PRId64";",
------------
Viva64-EM
full
702
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/profiler/heapsnapshot.c
error
V547
Expression 'item_chars < 0' is always false. Unsigned type value is never < 0.
false
1
            col->static_frames[i].file);
         if (item_chars < 0)
             MVM_panic(1, "Failed to save static frame in heap snapshot");
------------
Viva64-EM
full
732
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/profiler/heapsnapshot.c
error
V576
Incorrect format. Consider checking the fifth actual argument of the 'snprintf' function. The SIGNED integer type argument is expected.
false
3
         char tmp[256];
         size_t item_chars = snprintf(tmp, 256,
            "%"PRIu16",%"PRId32",%"PRIu16",%"PRIu64",%"PRIu64",%"PRIu32";",
------------
Viva64-EM
full
732
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/profiler/heapsnapshot.c
error
V576
Incorrect format. Consider checking the seventh actual argument of the 'snprintf' function. The memsize type argument is expected.
false
1
         char tmp[256];
         size_t item_chars = snprintf(tmp, 256,
            "%"PRIu16",%"PRId32",%"PRIu16",%"PRIu64",%"PRIu64",%"PRIu32";",
------------
Viva64-EM
full
732
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/profiler/heapsnapshot.c
error
V576
Incorrect format. Consider checking the eighth actual argument of the 'snprintf' function. The memsize type argument is expected.
false
1
         char tmp[256];
         size_t item_chars = snprintf(tmp, 256,
            "%"PRIu16",%"PRId32",%"PRIu16",%"PRIu64",%"PRIu64",%"PRIu32";",
------------
Viva64-EM
full
740
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/profiler/heapsnapshot.c
error
V547
Expression 'item_chars < 0' is always false. Unsigned type value is never < 0.
false
1
            s->collectables[i].num_refs);
         if (item_chars < 0)
             MVM_panic(1, "Failed to save collectable in heap snapshot");
------------
Viva64-EM
full
770
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/profiler/heapsnapshot.c
error
V576
Incorrect format. Consider checking the fourth actual argument of the 'snprintf' function. The memsize type argument is expected.
false
1
        char tmp[128];
        size_t item_chars = snprintf(tmp, 128, "%lu,%lu,%lu;",
            s->references[i].description & ((1 << MVM_SNAPSHOT_REF_KIND_BITS) - 1),
------------
Viva64-EM
full
770
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/profiler/heapsnapshot.c
error
V576
Incorrect format. Consider checking the fifth actual argument of the 'snprintf' function. The memsize type argument is expected.
false
1
        char tmp[128];
        size_t item_chars = snprintf(tmp, 128, "%lu,%lu,%lu;",
            s->references[i].description & ((1 << MVM_SNAPSHOT_REF_KIND_BITS) - 1),
------------
Viva64-EM
full
770
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/profiler/heapsnapshot.c
error
V576
Incorrect format. Consider checking the sixth actual argument of the 'snprintf' function. The memsize type argument is expected.
false
1
        char tmp[128];
        size_t item_chars = snprintf(tmp, 128, "%lu,%lu,%lu;",
            s->references[i].description & ((1 << MVM_SNAPSHOT_REF_KIND_BITS) - 1),
------------
Viva64-EM
full
774
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/profiler/heapsnapshot.c
error
V547
Expression 'item_chars < 0' is always false. Unsigned type value is never < 0.
false
1
            s->references[i].collectable_index);
        if (item_chars < 0)
            MVM_panic(1, "Failed to save reference in heap snapshot");
------------
Viva64-EM
full
193
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/instrument/crossthreadwrite.c
error
V576
Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
        uv_mutex_lock(&(tc->instance->mutex_cross_thread_write_logging));
        fprintf(stderr, "Thread %d %s an object allocated by thread %d\n",
            tc->thread_id, guilty_desc, written->header.owner);
------------
Viva64-EM
full
193
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/instrument/crossthreadwrite.c
error
V576
Incorrect format. Consider checking the fifth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.
false
3
        uv_mutex_lock(&(tc->instance->mutex_cross_thread_write_logging));
        fprintf(stderr, "Thread %d %s an object allocated by thread %d\n",
            tc->thread_id, guilty_desc, written->header.owner);
------------
Viva64-EM
full
32
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/platform/posix/time.c
error
V549
The first argument of 'nanosleep' function is equal to the second argument.
false
1
    timeout.tv_nsec = (long)((second - timeout.tv_sec) * E9F);
    while (nanosleep(&timeout, &timeout) && errno == EINTR);
}
------------
Viva64-EM
full
40
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/platform/posix/time.c
error
V549
The first argument of 'nanosleep' function is equal to the second argument.
false
1
    timeout.tv_nsec = nanos % E9;
    while (nanosleep(&timeout, &timeout) && errno == EINTR);
}
------------
Viva64-EM
full
90
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/3rdparty/dynasm/dasm_x86.h
error
V701
realloc() possible leak: when realloc() fails in allocating memory, original pointer '* Dst' is lost. Consider assigning realloc() to a temporary pointer.
false
2
  Dst_REF = NULL;
  DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection));
  D = Dst_REF;
------------
Viva64-EM
full
125
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/3rdparty/dynasm/dasm_x86.h
error
V701
realloc() possible leak: when realloc() fails in allocating memory, original pointer 'D->lglabels' is lost. Consider assigning realloc() to a temporary pointer.
false
2
  D->globals = gl - 10;  /* Negative bias to compensate for locals. */
  DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int));
}
------------
Viva64-EM
full
133
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/3rdparty/dynasm/dasm_x86.h
error
V701
realloc() possible leak: when realloc() fails in allocating memory, original pointer 'D->pclabels' is lost. Consider assigning realloc() to a temporary pointer.
false
2
  size_t osz = D->pcsize;
  DASM_M_GROW(Dst, int, D->pclabels, D->pcsize, maxpc*sizeof(int));
  memset((void *)(((unsigned char *)D->pclabels)+osz), 0, D->pcsize-osz);
------------
Viva64-EM
full
177
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/3rdparty/dynasm/dasm_x86.h
error
V701
realloc() possible leak: when realloc() fails in allocating memory, original pointer 'sec->buf' is lost. Consider assigning realloc() to a temporary pointer.
false
2
  if (pos >= sec->epos) {
    DASM_M_GROW(Dst, int, sec->buf, sec->bsize,
      sec->bsize + 2*DASM_MAXSECPOS*sizeof(int));
------------
Viva64-EM
full
542
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/src/jit/emit_x64.dasc
error
V573
Uninitialized variable 'body' was used. The variable was used to initialize itself.
false
1
        MVMint16 offset = ins->operands[2].lit_i16;
        MVMint16 body   = offsetof(MVMP6opaque, body);
        /* load address and object */
------------
Viva64-EM
full
220
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/3rdparty/sha1/sha1.c
error
V597
The compiler could delete the 'memset' function call, which is used to flush 'finalcount' buffer. The memset_s() function should be used to erase the private data.
false
1
    memset(context->count, 0, 8);
    memset(finalcount, 0, 8); /* SWR */
}
------------
Viva64-EM
full
132
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/3rdparty/libtommath/bn_mp_prime_next_prime.c
error
V658
A value is being subtracted from the unsigned variable. This can result in an overflow. In such a case, the '<' comparison operation can potentially behave unexpectedly. Consider inspecting the 'step < ((((mp_digit) 1) << 60) - kstep)' expression.
false
3
         }
      } while (y == 1 && step < ((((mp_digit)1)<<DIGIT_BIT) - kstep));
------------
Viva64-EM
full
140
/nfs/home/dmka/src/rakudo-star-2016.07/MoarVM/3rdparty/libtommath/bn_mp_prime_next_prime.c
error
V658
A value is being subtracted from the unsigned variable. This can result in an overflow. In such a case, the '>=' comparison operation can potentially behave unexpectedly. Consider inspecting the 'step >= ((((mp_digit) 1) << 60) - kstep)' expression.
false
3
      /* if didn't pass sieve and step == MAX then skip test */
      if (y == 1 && step >= ((((mp_digit)1)<<DIGIT_BIT) - kstep)) {
         continue;

Reply via email to