Skip to content

Instantly share code, notes, and snippets.

@timo
Created February 21, 2017 22:58
Show Gist options
  • Save timo/aa786e6fe415b6bb21c176659391e841 to your computer and use it in GitHub Desktop.
Save timo/aa786e6fe415b6bb21c176659391e841 to your computer and use it in GitHub Desktop.
coverity "new defects" for moarvm 2017.02-2-g16eac84
Hi,
Please find the latest report on new defect(s) introduced to paultcochrane/MoarVM found with Coverity Scan.
4 new defect(s) introduced to paultcochrane/MoarVM found with Coverity Scan.
8 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build analyzed by Coverity Scan.
New defect(s) Reported-by: Coverity Scan
Showing 4 of 4 defect(s)
** CID 141569: Code maintainability issues (UNUSED_VALUE)
/src/strings/unicode.c: 68674 in generate_codepoints_by_name()
________________________________________________________________________________________________________
*** CID 141569: Code maintainability issues (UNUSED_VALUE)
/src/strings/unicode.c: 68674 in generate_codepoints_by_name()
68668 codepoint++;
68669 codepoint_table_index++;
68670 }
68671 break;
68672 }
68673 case 1:
>>> CID 141569: Code maintainability issues (UNUSED_VALUE)
>>> Assigning value from "codepoint + length" to "codepoint" here, but that stored value is overwritten before it can be used.
68674 codepoint += length;
68675 break;
68676 case 2: {
68677 const char *name = codepoint_names[codepoint_table_index];
68678 if (name) {
68679 MVMUnicodeNameRegistry *entry = MVM_malloc(sizeof(MVMUnicodeNameRegistry));
** CID 141568: (UNINIT)
/src/strings/utf8_c8.c: 422 in MVM_string_utf8_c8_decodestream()
/src/strings/utf8_c8.c: 422 in MVM_string_utf8_c8_decodestream()
/src/strings/utf8_c8.c: 422 in MVM_string_utf8_c8_decodestream()
/src/strings/utf8_c8.c: 422 in MVM_string_utf8_c8_decodestream()
________________________________________________________________________________________________________
*** CID 141568: (UNINIT)
/src/strings/utf8_c8.c: 422 in MVM_string_utf8_c8_decodestream()
416 MVMDecodeStreamSeparators *seps,
417 MVMint32 eof) {
418 /* Local state for decode loop. */
419 MVMDecodeStreamBytes *cur_bytes;
420 MVMDecodeStreamBytes *last_accept_bytes = ds->bytes_head;
421 MVMint32 last_accept_pos = ds->bytes_head_pos;
>>> CID 141568: (UNINIT)
>>> Declaring variable "state" without initializer.
422 DecodeState state;
423 int expected_continuations = 0;
424 int min_expected_codepoint;
425 MVMuint32 reached_stopper = 0;
426 MVMint32 result_graphs = 0;
427
/src/strings/utf8_c8.c: 422 in MVM_string_utf8_c8_decodestream()
416 MVMDecodeStreamSeparators *seps,
417 MVMint32 eof) {
418 /* Local state for decode loop. */
419 MVMDecodeStreamBytes *cur_bytes;
420 MVMDecodeStreamBytes *last_accept_bytes = ds->bytes_head;
421 MVMint32 last_accept_pos = ds->bytes_head_pos;
>>> CID 141568: (UNINIT)
>>> Declaring variable "state" without initializer.
422 DecodeState state;
423 int expected_continuations = 0;
424 int min_expected_codepoint;
425 MVMuint32 reached_stopper = 0;
426 MVMint32 result_graphs = 0;
427
/src/strings/utf8_c8.c: 422 in MVM_string_utf8_c8_decodestream()
416 MVMDecodeStreamSeparators *seps,
417 MVMint32 eof) {
418 /* Local state for decode loop. */
419 MVMDecodeStreamBytes *cur_bytes;
420 MVMDecodeStreamBytes *last_accept_bytes = ds->bytes_head;
421 MVMint32 last_accept_pos = ds->bytes_head_pos;
>>> CID 141568: (UNINIT)
>>> Declaring variable "state" without initializer.
422 DecodeState state;
423 int expected_continuations = 0;
424 int min_expected_codepoint;
425 MVMuint32 reached_stopper = 0;
426 MVMint32 result_graphs = 0;
427
/src/strings/utf8_c8.c: 422 in MVM_string_utf8_c8_decodestream()
416 MVMDecodeStreamSeparators *seps,
417 MVMint32 eof) {
418 /* Local state for decode loop. */
419 MVMDecodeStreamBytes *cur_bytes;
420 MVMDecodeStreamBytes *last_accept_bytes = ds->bytes_head;
421 MVMint32 last_accept_pos = ds->bytes_head_pos;
>>> CID 141568: (UNINIT)
>>> Declaring variable "state" without initializer.
422 DecodeState state;
423 int expected_continuations = 0;
424 int min_expected_codepoint;
425 MVMuint32 reached_stopper = 0;
426 MVMint32 result_graphs = 0;
427
** CID 141567: Incorrect expression (NO_EFFECT)
/src/gc/finalize.c: 16 in MVM_gc_finalize_add_to_queue()
________________________________________________________________________________________________________
*** CID 141567: Incorrect expression (NO_EFFECT)
/src/gc/finalize.c: 16 in MVM_gc_finalize_add_to_queue()
10 MVM_SC_WB_ST(tc, st);
11 }
12
13 /* Adds an object we've just allocated to the queue of those with finalizers
14 * that will need calling upon collection. */
15 void MVM_gc_finalize_add_to_queue(MVMThreadContext *tc, MVMObject *obj) {
>>> CID 141567: Incorrect expression (NO_EFFECT)
>>> Part "tc" of statement "tc , obj" has no effect due to the comma.
16 MVM_ASSERT_NOT_FROMSPACE(tc, obj);
17 if (tc->num_finalize == tc->alloc_finalize) {
18 if (tc->alloc_finalize)
19 tc->alloc_finalize *= 2;
20 else
21 tc->alloc_finalize = 64;
** CID 141566: Control flow issues (MISSING_BREAK)
/src/strings/ops.c: 1912 in MVM_string_compute_hash_code()
________________________________________________________________________________________________________
*** CID 141566: Control flow issues (MISSING_BREAK)
/src/strings/ops.c: 1912 in MVM_string_compute_hash_code()
1906 switch (graphs_remaining * 4) {
1907 case 8:
1908 _hj_j += ( (unsigned)hash_block.bytes[7] << 24 ) +
1909 ( (unsigned)hash_block.bytes[6] << 16 ) +
1910 ( (unsigned)hash_block.bytes[5] << 8 ) +
1911 hash_block.bytes[4];
>>> CID 141566: Control flow issues (MISSING_BREAK)
>>> The above case falls through to this one.
1912 case 4:
1913 _hj_i += ( (unsigned)hash_block.bytes[3] << 24 ) +
1914 ( (unsigned)hash_block.bytes[2] << 16 ) +
1915 ( (unsigned)hash_block.bytes[1] << 8 ) +
1916 hash_block.bytes[0];
1917 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment