Task #51787 - ruby-3.4.2-24.fc43/scan-results.err
back to task #51787download
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/location.c: scope_hint: In function ‘rbs_loc_alloc_children’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/location.c:39:18: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*loc.children’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/location.c: scope_hint: In function ‘rbs_loc_alloc_children’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/location.c:36:14: note: in expansion of macro ‘RBS_LOC_CHILDREN_SIZE’
# 37| loc->children = malloc(s);
# 38|
# 39|-> *loc->children = (rbs_loc_children) {
# 40| .len = 0,
# 41| .required_p = 0,
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/location.c:69:35: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘*loc.children’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/location.c: scope_hint: In function ‘rbs_loc_add_optional_child’
# 67| check_children_cap(loc);
# 68|
# 69|-> unsigned short i = loc->children->len++;
# 70| loc->children->entries[i] = (rbs_loc_entry) {
# 71| .name = name,
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/location.c: scope_hint: In function ‘rbs_loc_add_optional_child’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/location.c:69:35: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/location.c: scope_hint: In function ‘rbs_loc_add_optional_child’
# 67| check_children_cap(loc);
# 68|
# 69|-> unsigned short i = loc->children->len++;
# 70| loc->children->entries[i] = (rbs_loc_entry) {
# 71| .name = name,
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:8: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: table
# 6| id_table *table = malloc(sizeof(id_table));
# 7|
# 8|-> *table = (id_table) {
# 9| .size = 10,
# 10| .count = 0,
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c: scope_hint: In function ‘alloc_empty_table’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:8:10: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘table’
ruby-3.4.2/include/ruby/internal/fl_type.h:38: included_from: Included from here.
ruby-3.4.2/include/ruby/internal/core/rstring.h:30: included_from: Included from here.
ruby-3.4.2/include/ruby/internal/arithmetic/char.h:29: included_from: Included from here.
ruby-3.4.2/include/ruby/internal/arithmetic.h:24: included_from: Included from here.
ruby-3.4.2/include/ruby/ruby.h:28: included_from: Included from here.
ruby-3.4.2/include/ruby.h:38: included_from: Included from here.
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/rbs_extension.h:3: included_from: Included from here.
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:1: included_from: Included from here.
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:342:10: note: in expansion of macro ‘RB_TYPE_P’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:342:10: note: in expansion of macro ‘RB_TYPE_P’
ruby-3.4.2/include/ruby/internal/value_type.h:376:1: note: in expansion of macro ‘RB_TYPE_P’
ruby-3.4.2/include/ruby/internal/arithmetic/long.h:42: included_from: Included from here.
ruby-3.4.2/include/ruby/internal/arithmetic/int.h:26: included_from: Included from here.
ruby-3.4.2/include/ruby/internal/arithmetic/char.h:23: included_from: Included from here.
ruby-3.4.2/include/ruby/internal/value_type.h:349:14: note: in expansion of macro ‘RB_SPECIAL_CONST_P’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c: scope_hint: In function ‘alloc_empty_table’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:342:10: note: in expansion of macro ‘RB_TYPE_P’
# 6| id_table *table = malloc(sizeof(id_table));
# 7|
# 8|-> *table = (id_table) {
# 9| .size = 10,
# 10| .count = 0,
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:21: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: table
# 19| id_table *table = malloc(sizeof(id_table));
# 20|
# 21|-> *table = (id_table) {
# 22| .size = 0,
# 23| .count = 0,
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c: scope_hint: In function ‘alloc_reset_table’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:21:10: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘table’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:342:10: note: in expansion of macro ‘RB_TYPE_P’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:342:10: note: in expansion of macro ‘RB_TYPE_P’
ruby-3.4.2/include/ruby/internal/value_type.h:376:1: note: in expansion of macro ‘RB_TYPE_P’
ruby-3.4.2/include/ruby/internal/value_type.h:349:14: note: in expansion of macro ‘RB_SPECIAL_CONST_P’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c: scope_hint: In function ‘alloc_reset_table’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:342:10: note: in expansion of macro ‘RB_TYPE_P’
# 19| id_table *table = malloc(sizeof(id_table));
# 20|
# 21|-> *table = (id_table) {
# 22| .size = 0,
# 23| .count = 0,
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c: scope_hint: In function ‘parser_insert_typevar’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:80:30: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*table.ids + *table.count * 8’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:342:10: note: in expansion of macro ‘RB_TYPE_P’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:342:10: note: in expansion of macro ‘RB_TYPE_P’
ruby-3.4.2/include/ruby/internal/value_type.h:376:1: note: in expansion of macro ‘RB_TYPE_P’
ruby-3.4.2/include/ruby/internal/value_type.h:349:14: note: in expansion of macro ‘RB_SPECIAL_CONST_P’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c: scope_hint: In function ‘parser_insert_typevar’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:342:10: note: in expansion of macro ‘RB_TYPE_P’
ruby-3.4.2/include/ruby/internal/core/rarray.h: scope_hint: In function ‘parser_insert_typevar’
ruby-3.4.2/include/ruby/internal/core/rarray.h:260:16: note: in expansion of macro ‘RARRAY_EMBED_LEN’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c: scope_hint: In function ‘parser_insert_typevar’
ruby-3.4.2/include/ruby/internal/arithmetic/long.h:352:9: note: in expansion of macro ‘RB_INT2FIX’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:351:21: note: in expansion of macro ‘INT2FIX’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c: scope_hint: In function ‘parser_insert_typevar’
# 78| }
# 79|
# 80|-> table->ids[table->count++] = id;
# 81| }
# 82|
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:107: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: state
# 105|
# 106| void parser_advance(parserstate *state) {
# 107|-> state->current_token = state->next_token;
# 108| state->next_token = state->next_token2;
# 109| state->next_token2 = state->next_token3;
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:108: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: state
# 106| void parser_advance(parserstate *state) {
# 107| state->current_token = state->next_token;
# 108|-> state->next_token = state->next_token2;
# 109| state->next_token2 = state->next_token3;
# 110|
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:109: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: state
# 107| state->current_token = state->next_token;
# 108| state->next_token = state->next_token2;
# 109|-> state->next_token2 = state->next_token3;
# 110|
# 111| while (true) {
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:112: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: state
# 110|
# 111| while (true) {
# 112|-> if (state->next_token3.type == pEOF) {
# 113| break;
# 114| }
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:116: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: state
# 114| }
# 115|
# 116|-> state->next_token3 = rbsparser_next_token(state->lexstate);
# 117|
# 118| if (state->next_token3.type == tCOMMENT) {
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:118: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: state
# 116| state->next_token3 = rbsparser_next_token(state->lexstate);
# 117|
# 118|-> if (state->next_token3.type == tCOMMENT) {
# 119| // skip
# 120| } else if (state->next_token3.type == tLINECOMMENT) {
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:197: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new_comment
# 195| comment *new_comment = malloc(sizeof(comment));
# 196|
# 197|-> *new_comment = (comment) {
# 198| .start = comment_token.range.start,
# 199| .end = comment_token.range.end,
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c: scope_hint: In function ‘alloc_comment’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:197:16: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘new_comment’
# 195| comment *new_comment = malloc(sizeof(comment));
# 196|
# 197|-> *new_comment = (comment) {
# 198| .start = comment_token.range.start,
# 199| .end = comment_token.range.end,
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:223: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: com
# 221|
# 222| void comment_insert_new_line(comment *com, token comment_token) {
# 223|-> if (com->line_count == 0) {
# 224| com->start = comment_token.range.start;
# 225| }
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:227: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: com
# 225| }
# 226|
# 227|-> if (com->line_count == com->line_size) {
# 228| com->line_size += 10;
# 229|
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:240: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: com
# 238| }
# 239|
# 240|-> com->tokens[com->line_count++] = comment_token;
# 241| com->end = comment_token.range.end;
# 242| }
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c: scope_hint: In function ‘comment_insert_new_line’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:240:34: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*com.tokens + *com.line_count * 36’
# 238| }
# 239|
# 240|-> com->tokens[com->line_count++] = comment_token;
# 241| com->end = comment_token.range.end;
# 242| }
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:241: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: com
# 239|
# 240| com->tokens[com->line_count++] = comment_token;
# 241|-> com->end = comment_token.range.end;
# 242| }
# 243|
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:304: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: lexer
# 302| };
# 303|
# 304|-> *lexer = (lexstate) {
# 305| .string = string,
# 306| .start_pos = start_pos,
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c: scope_hint: In function ‘alloc_lexer’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:304:10: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘lexer’
# 302| };
# 303|
# 304|-> *lexer = (lexstate) {
# 305| .string = string,
# 306| .start_pos = start_pos,
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:315: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: lexer
# 313|
# 314| skipn(lexer, start_pos);
# 315|-> lexer->start = lexer->current;
# 316| lexer->first_token_of_line = lexer->current.column == 0;
# 317|
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:316: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: lexer
# 314| skipn(lexer, start_pos);
# 315| lexer->start = lexer->current;
# 316|-> lexer->first_token_of_line = lexer->current.column == 0;
# 317|
# 318| return lexer;
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:324: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: parser
# 322| parserstate *parser = malloc(sizeof(parserstate));
# 323|
# 324|-> *parser = (parserstate) {
# 325| .lexstate = lexer,
# 326|
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c: scope_hint: In function ‘alloc_parser’
ruby-3.4.2/.bundle/gems/rbs-3.8.0/ext/rbs_extension/parserstate.c:324:11: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘parser’
# 322| parserstate *parser = malloc(sizeof(parserstate));
# 323|
# 324|-> *parser = (parserstate) {
# 325| .lexstate = lexer,
# 326|
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/addr2line.c: scope_hint: In function ‘sleb128’
ruby-3.4.2/addr2line.c:240:42: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
ruby-3.4.2/addr2line.c: scope_hint: In function ‘sleb128’
# 238| int s = 0;
# 239| for (;;) {
# 240|-> unsigned char b = (unsigned char)*(*p)++;
# 241| if (b < 0x80) {
# 242| if (b & 0x40) {
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/addr2line.c:1953: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: lp
# 1951| if (lines[i].sname) {
# 1952| line_info_t *lp = malloc(sizeof(line_info_t));
# 1953|-> memcpy(lp, &lines[i], sizeof(line_info_t));
# 1954| lines[i].next = lp;
# 1955| lp->dirname = line.dirname;
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/addr2line.c:1955: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: lp
# 1953| memcpy(lp, &lines[i], sizeof(line_info_t));
# 1954| lines[i].next = lp;
# 1955|-> lp->dirname = line.dirname;
# 1956| lp->filename = line.filename;
# 1957| lp->line = line.line;
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/addr2line.c:1956: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: lp
# 1954| lines[i].next = lp;
# 1955| lp->dirname = line.dirname;
# 1956|-> lp->filename = line.filename;
# 1957| lp->line = line.line;
# 1958| lp->saddr = 0;
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/addr2line.c:1957: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: lp
# 1955| lp->dirname = line.dirname;
# 1956| lp->filename = line.filename;
# 1957|-> lp->line = line.line;
# 1958| lp->saddr = 0;
# 1959| }
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/addr2line.c:1958: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: lp
# 1956| lp->filename = line.filename;
# 1957| lp->line = line.line;
# 1958|-> lp->saddr = 0;
# 1959| }
# 1960| lines[i].path = reader->obj->path;
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/addr2line.c: scope_hint: In function ‘rb_dump_backtrace_with_lines’
ruby-3.4.2/addr2line.c:2634:23: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘obj’
# 2632| memcpy(main_path, binary_filename, len+1);
# 2633| append_obj(&obj);
# 2634|-> obj->path = main_path;
# 2635| addr = fill_lines(num_traces, traces, 1, &obj, lines, 0, errout);
# 2636| if (addr != (uintptr_t)-1) {
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/addr2line.c:2646: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: lines
# 2644| for (i = 0; i < num_traces; i++) {
# 2645| Dl_info info;
# 2646|-> if (lines[i].line) continue;
# 2647| if (dladdr(traces[i], &info)) {
# 2648| const char *path;
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/bignum.c:1365: warning[nullPointer]: Possible null pointer dereference: yds
# 1363| num = borrow ? -1 : 0;
# 1364| for (i = 0; i < sn; i++) {
# 1365|-> num += (BDIGIT_DBL_SIGNED)xds[i] - yds[i];
# 1366| zds[i] = BIGLO(num);
# 1367| num = BIGDN(num);
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/cont.c:1258: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: cont
# 1256| if (cont == NULL)
# 1257| rb_memerror();
# 1258|-> cont->ec = ec;
# 1259|
# 1260| rb_native_mutex_lock(&jit_cont_lock);
Error: CPPCHECK_WARNING (CWE-758):
ruby-3.4.2/debug.c:234: warning[objectIndex]: The address of variable 'ruby_rgengc_debug' might be accessed at non-zero index.
# 232| SET_WHEN("core", ruby_enable_coredump, 1);
# 233| SET_WHEN("ci", ruby_on_ci, 1);
# 234|-> SET_WHEN_UINT("rgengc", &ruby_rgengc_debug, 1, ruby_rgengc_debug = 1);
# 235| #if defined _WIN32
# 236| # if RUBY_MSVCRT_VERSION >= 80
Error: CPPCHECK_WARNING (CWE-457):
ruby-3.4.2/dln.c:516: error[legacyUninitvar]: Uninitialized variable: *(&init_fct_name)
# 514|
# 515| char *init_fct_name;
# 516|-> init_funcname(&init_fct_name, file);
# 517|
# 518| /* Call the init code */
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/encoding.c:1039:15: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
ruby-3.4.2/encoding.c: scope_hint: In function ‘rb_encoding_check.part.0’
# 1037| return "BINARY (ASCII-8BIT)";
# 1038| }
# 1039|-> return enc->name;
# 1040| }
# 1041|
Error: GCC_ANALYZER_WARNING (CWE-835):
ruby-3.4.2/enum.c: scope_hint: In function ‘nmin_filter’
ruby-3.4.2/enum.c:2016:41: warning[-Wanalyzer-infinite-loop]: infinite loop
ruby-3.4.2/include/ruby/internal/core.h:23: included_from: Included from here.
ruby-3.4.2/include/ruby/ruby.h:29: included_from: Included from here.
ruby-3.4.2/internal.h:31: included_from: Included from here.
ruby-3.4.2/enum.c:13: included_from: Included from here.
ruby-3.4.2/include/ruby/internal/core/rarray.h:366:1: note: in expansion of macro ‘RARRAY_PTR’
# 2014|
# 2015| while (1) {
# 2016|-> long pivot_index = left + (right-left)/2;
# 2017| long num_pivots = 1;
# 2018|
Error: GCC_ANALYZER_WARNING (CWE-457):
ruby-3.4.2/error.c: scope_hint: In function ‘open_report_path’
ruby-3.4.2/error.c:892:16: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*buf’
ruby-3.4.2/error.c:1097:5: note: in expansion of macro ‘report_bug_valist’
ruby-3.4.2/error.c:1097:5: note: in expansion of macro ‘report_bug_valist’
ruby-3.4.2/error.c:16: included_from: Included from here.
/usr/include/stdio.h:264:14: note: argument 1 of ‘fopen’ must be a pointer to a null-terminated string
# 890| else if (*template) {
# 891| expand_report_argument(&template, &values, buf, size, false);
# 892|-> return fopen(buf, "w");
# 893| }
# 894| return NULL;
Error: CPPCHECK_WARNING (CWE-758):
ruby-3.4.2/ext/-test-/thread/instrumentation/instrumentation.c:166: error[missingReturn]: Found an exit path from function with non-void return type that has missing return statement
# 164| default:
# 165| rb_bug("TestThreadInstrumentation: Unexpected event");
# 166|-> break;
# 167| }
# 168| }
Error: CPPCHECK_WARNING (CWE-457):
ruby-3.4.2/ext/cgi/escape/escape.c:172: error[uninitvar]: Uninitialized variable: buf
# 170| rb_str_cat(dest, cstr + beg, plen);
# 171| if (charlimit > 256) {
# 172|-> rb_str_cat(dest, buf, rb_enc_mbcput((OnigCodePoint)cc, buf, enc));
# 173| }
# 174| else {
Error: CPPCHECK_WARNING (CWE-457):
ruby-3.4.2/ext/digest/digest.c:587: warning[uninitvar]: Uninitialized variable: obj
# 585| rb_raise(rb_eRuntimeError, "Digest::Base cannot be directly inherited in Ruby");
# 586|
# 587|-> algo = get_metadata_ptr(obj);
# 588| if (!algo) {
# 589| if (p == klass)
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/ext/fiddle/pointer.c: scope_hint: In function ‘fiddle_ptr_get_memory_view’
ruby-3.4.2/ext/fiddle/pointer.c:120:65: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
# 118| {
# 119| struct ptr_data *data = fiddle_ptr_check_memory_view(obj);
# 120|-> rb_memory_view_init_as_byte_array(view, obj, data->ptr, data->size, true);
# 121|
# 122| return true;
Error: COMPILER_WARNING (CWE-563):
ruby-3.4.2/ext/socket/ipsocket.c: scope_hint: In function ‘rsock_init_inetsock’
ruby-3.4.2/ext/socket/ipsocket.c:1236:17: warning[-Wunused-value]: statement with no effect
# 1236 | for (tmp_p; tmp_p != NULL; tmp_p = tmp_p->ai_next) {
# | ^~~
# 1234|
# 1235| struct addrinfo *tmp_p = local_res->ai;
# 1236|-> for (tmp_p; tmp_p != NULL; tmp_p = tmp_p->ai_next) {
# 1237| if (target_families[0] == 0 && tmp_p->ai_family == AF_INET6) {
# 1238| target_families[0] = AF_INET6;
Error: GCC_ANALYZER_WARNING (CWE-775):
ruby-3.4.2/ext/socket/unixsocket.c: scope_hint: In function ‘rsock_init_unixsock’
ruby-3.4.2/ext/socket/unixsocket.c:103:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘rsock_socket(1, 1, 0)’
ruby-3.4.2/include/ruby/internal/fl_type.h:38: included_from: Included from here.
ruby-3.4.2/include/ruby/internal/core/rstring.h:30: included_from: Included from here.
ruby-3.4.2/include/ruby/internal/arithmetic/char.h:29: included_from: Included from here.
ruby-3.4.2/include/ruby/internal/arithmetic.h:24: included_from: Included from here.
ruby-3.4.2/include/ruby/ruby.h:28: included_from: Included from here.
ruby-3.4.2/internal.h:31: included_from: Included from here.
ruby-3.4.2/ext/socket/rubysocket.h:139: included_from: Included from here.
ruby-3.4.2/ext/socket/unixsocket.c:11: included_from: Included from here.
ruby-3.4.2/ext/socket/unixsocket.c:37:23: note: in expansion of macro ‘RB_TYPE_P’
ruby-3.4.2/include/ruby/internal/value_type.h:376:1: note: in expansion of macro ‘RB_TYPE_P’
ruby-3.4.2/include/ruby/internal/arithmetic/long.h:42: included_from: Included from here.
ruby-3.4.2/include/ruby/internal/arithmetic/int.h:26: included_from: Included from here.
ruby-3.4.2/include/ruby/internal/arithmetic/char.h:23: included_from: Included from here.
ruby-3.4.2/include/ruby/internal/value_type.h:349:14: note: in expansion of macro ‘RB_SPECIAL_CONST_P’
ruby-3.4.2/ext/socket/unixsocket.c: scope_hint: In function ‘rsock_init_unixsock’
ruby-3.4.2/ext/socket/unixsocket.c:37:23: note: in expansion of macro ‘RB_TYPE_P’
ruby-3.4.2/ext/socket/unixsocket.c:67:31: note: in expansion of macro ‘RSTRING_PTR’
ruby-3.4.2/ext/socket/unixsocket.c: scope_hint: In function ‘rsock_init_unixsock’
# 101|
# 102| if (server) {
# 103|-> if (listen(fd, SOMAXCONN) < 0) {
# 104| int e = errno;
# 105| rb_io_close(io);
Error: CPPCHECK_WARNING (CWE-457):
ruby-3.4.2/gc.c:4391: warning[uninitvar]: Uninitialized variable: buff
# 4389| }
# 4390|
# 4391|-> return buff;
# 4392| }
# 4393|
Error: COMPILER_WARNING (CWE-563):
ruby-3.4.2/include/ruby/defines.h:72: included_from: Included from here.
ruby-3.4.2/include/ruby/ruby.h:25: included_from: Included from here.
ruby-3.4.2/constant.h:13: included_from: Included from here.
ruby-3.4.2/gc.c:84: included_from: Included from here.
ruby-3.4.2/gc/default/default.c: scope_hint: In function ‘rb_gc_impl_new_obj’
ruby-3.4.2/gc/default/default.c:853:42: warning[-Wunused-value]: left-hand operand of comma expression has no effect
# 853 | #define stress_to_class (objspace, 0)
# | ^
ruby-3.4.2/include/ruby/backward/2/assume.h:50:46: note: in definition of macro ‘RB_UNLIKELY’
# 50 | # define RB_UNLIKELY(x) (__builtin_expect(!!(x), 0))
# | ^
ruby-3.4.2/gc/default/default.c:2519:21: note: in expansion of macro ‘stress_to_class’
# 2519 | if (RB_UNLIKELY(stress_to_class)) {
# | ^~~~~~~~~~~~~~~
# 851| #define set_stress_to_class(c) (stress_to_class = (c))
# 852| #else
# 853|-> #define stress_to_class (objspace, 0)
# 854| #define set_stress_to_class(c) (objspace, (c))
# 855| #endif
Error: CPPCHECK_WARNING (CWE-457):
ruby-3.4.2/gc/default/default.c:1338: warning[uninitvar]: Uninitialized variable: ret
# 1336| ret = BUILTIN_TYPE(obj) == T_MOVED;
# 1337| }
# 1338|-> return ret;
# 1339| }
# 1340| }
Error: CPPCHECK_WARNING (CWE-457):
ruby-3.4.2/gc/default/default.c:4023: warning[uninitvar]: Uninitialized variable: destination
# 4021| }
# 4022|
# 4023|-> return destination;
# 4024| }
# 4025|
Error: CPPCHECK_WARNING (CWE-252):
ruby-3.4.2/gc/default/default.c:8285: error[leakReturnValNotUsed]: Return value of allocation function 'realloc' is not stored.
# 8283|
# 8284| old_size = objspace_malloc_size(objspace, ptr, old_size);
# 8285|-> TRY_WITH_GC(new_size, mem = RB_GNUC_EXTENSION_BLOCK(realloc(ptr, new_size)));
# 8286| if (!mem) return mem;
# 8287| new_size = objspace_malloc_size(objspace, mem, new_size);
Error: GCC_ANALYZER_WARNING (CWE-131):
ruby-3.4.2/imemo.c: scope_hint: In function ‘rb_alloc_tmp_buffer_with_count’
ruby-3.4.2/imemo.c:73:17: warning[-Wanalyzer-allocation-size]: allocated buffer size is not a multiple of the pointee's size
# 71| *store = (VALUE)tmpbuf;
# 72| ptr = ruby_xmalloc(size);
# 73|-> tmpbuf->ptr = ptr;
# 74| tmpbuf->cnt = cnt;
# 75|
Error: GCC_ANALYZER_WARNING (CWE-775):
ruby-3.4.2/include/ruby/internal/arithmetic/long.h:118:32: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(rb_string_value_cstr(&path), 0)’
ruby-3.4.2/spec/ruby/optional/capi/ext/string_spec.c: scope_hint: In function ‘string_spec_RSTRING_PTR_read’
ruby-3.4.2/include/ruby/internal/arithmetic/long.h:49:22: note: in expansion of macro ‘RB_INT2FIX’
ruby-3.4.2/include/ruby/internal/arithmetic/long_long.h:97:31: note: in expansion of macro ‘LONG2FIX’
# 116| * defined. Also it can be compiled into a single LEA instruction. */
# 117| const unsigned long j = RBIMPL_CAST((unsigned long)i);
# 118|-> const unsigned long k = (j << 1) + RUBY_FIXNUM_FLAG;
# 119| const long l = RBIMPL_CAST((long)k);
# 120| const SIGNED_VALUE m = l; /* Sign extend */
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/include/ruby/internal/encoding/encoding.h:419:15: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘enc_io’
ruby-3.4.2/ext/stringio/stringio.c: scope_hint: In function ‘prepare_getline_args’
ruby-3.4.2/include/ruby/ruby.h:46: included_from: Included from here.
ruby-3.4.2/include/ruby.h:38: included_from: Included from here.
ruby-3.4.2/ext/stringio/stringio.c:20: included_from: Included from here.
ruby-3.4.2/include/ruby/internal/scan_args.h:498:9: note: in expansion of macro ‘rb_scan_args0’
ruby-3.4.2/ext/stringio/stringio.c:1174:12: note: in expansion of macro ‘rb_scan_args’
ruby-3.4.2/include/ruby/internal/scan_args.h:498:9: note: in expansion of macro ‘rb_scan_args0’
ruby-3.4.2/ext/stringio/stringio.c:1174:12: note: in expansion of macro ‘rb_scan_args’
ruby-3.4.2/include/ruby/internal/scan_args.h:422:15: note: in expansion of macro ‘rb_scan_args_next_param’
ruby-3.4.2/ext/stringio/stringio.c: scope_hint: In function ‘prepare_getline_args’
ruby-3.4.2/ext/stringio/stringio.c:1202:18: note: in expansion of macro ‘get_enc’
ruby-3.4.2/ext/stringio/stringio.c: scope_hint: In function ‘prepare_getline_args’
# 417| rb_enc_name(rb_encoding *enc)
# 418| {
# 419|-> return enc->name;
# 420| }
# 421|
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/include/ruby/internal/encoding/encoding.h:434:15: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
ruby-3.4.2/encoding.c: scope_hint: In function ‘rb_to_encoding_index.part.0’
ruby-3.4.2/encoding.c:273:10: note: in expansion of macro ‘rb_enc_asciicompat’
ruby-3.4.2/encoding.c:273:10: note: in expansion of macro ‘rb_enc_asciicompat’
# 432| rb_enc_mbminlen(rb_encoding *enc)
# 433| {
# 434|-> return enc->min_enc_len;
# 435| }
# 436|
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/include/ruby/internal/encoding/encoding.h:434:15: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘enc’
ruby-3.4.2/ext/stringio/stringio.c: scope_hint: In function ‘rb_enc_asciicompat’
ruby-3.4.2/include/ruby/internal/scan_args.h:498:9: note: in expansion of macro ‘rb_scan_args0’
ruby-3.4.2/ext/stringio/stringio.c:1174:12: note: in expansion of macro ‘rb_scan_args’
ruby-3.4.2/include/ruby/internal/scan_args.h:498:9: note: in expansion of macro ‘rb_scan_args0’
ruby-3.4.2/ext/stringio/stringio.c:1174:12: note: in expansion of macro ‘rb_scan_args’
ruby-3.4.2/include/ruby/internal/scan_args.h:422:15: note: in expansion of macro ‘rb_scan_args_next_param’
ruby-3.4.2/ext/stringio/stringio.c: scope_hint: In function ‘rb_enc_asciicompat’
ruby-3.4.2/ext/stringio/stringio.c:1202:18: note: in expansion of macro ‘get_enc’
ruby-3.4.2/include/ruby/internal/arithmetic/char.h:29: included_from: Included from here.
ruby-3.4.2/include/ruby/internal/arithmetic.h:24: included_from: Included from here.
ruby-3.4.2/include/ruby/ruby.h:28: included_from: Included from here.
ruby-3.4.2/ext/stringio/stringio.c:1205:15: note: in expansion of macro ‘RSTRING_LEN’
ruby-3.4.2/ext/stringio/stringio.c:1205:39: note: in expansion of macro ‘rb_enc_asciicompat’
ruby-3.4.2/ext/stringio/stringio.c:1205:39: note: in expansion of macro ‘rb_enc_asciicompat’
# 432| rb_enc_mbminlen(rb_encoding *enc)
# 433| {
# 434|-> return enc->min_enc_len;
# 435| }
# 436|
Error: CPPCHECK_WARNING (CWE-758):
ruby-3.4.2/include/ruby/internal/fl_type.h:348: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 346| RBIMPL_FL_USER_N(18), /**< User-defined flag. */
# 347| #ifdef ENUM_OVER_INT
# 348|-> RBIMPL_FL_USER_N(19), /**< User-defined flag. */
# 349| #else
# 350| # define RUBY_FL_USER19 (RBIMPL_VALUE_ONE<<(RUBY_FL_USHIFT+19))
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/include/ruby/internal/memory.h:671: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: dest
# 669| {
# 670| if (n) {
# 671|-> return memcpy(dest, src, n);
# 672| }
# 673| else {
Error: CPPCHECK_WARNING (CWE-457):
ruby-3.4.2/include/ruby/internal/memory.h:674: warning[uninitvar]: Uninitialized variable: dest
# 672| }
# 673| else {
# 674|-> return dest;
# 675| }
# 676| }
Error: GCC_ANALYZER_WARNING (CWE-457):
ruby-3.4.2/include/ruby/internal/arithmetic/long.h:42: included_from: Included from here.
ruby-3.4.2/include/ruby/internal/arithmetic/int.h:26: included_from: Included from here.
ruby-3.4.2/include/ruby/internal/arithmetic/char.h:23: included_from: Included from here.
ruby-3.4.2/include/ruby/internal/arithmetic.h:24: included_from: Included from here.
ruby-3.4.2/include/ruby/ruby.h:28: included_from: Included from here.
ruby-3.4.2/include/ruby.h:38: included_from: Included from here.
ruby-3.4.2/ext/openssl/ossl.h:16: included_from: Included from here.
ruby-3.4.2/ext/openssl/ossl_pkcs12.c:5: included_from: Included from here.
ruby-3.4.2/ext/openssl/ossl_pkcs12.c: scope_hint: In function ‘ossl_pkcs12_initialize’
ruby-3.4.2/include/ruby/internal/special_consts.h:75:28: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘pass’
ruby-3.4.2/include/ruby/internal/special_consts.h:55:25: note: in expansion of macro ‘RB_NIL_P’
ruby-3.4.2/ext/openssl/ossl_pkcs12.c:197:18: note: in expansion of macro ‘NIL_P’
ruby-3.4.2/include/ruby/ruby.h:46: included_from: Included from here.
ruby-3.4.2/include/ruby/internal/scan_args.h:498:9: note: in expansion of macro ‘rb_scan_args0’
ruby-3.4.2/ext/openssl/ossl_pkcs12.c:196:8: note: in expansion of macro ‘rb_scan_args’
ruby-3.4.2/include/ruby/internal/scan_args.h:498:9: note: in expansion of macro ‘rb_scan_args0’
ruby-3.4.2/ext/openssl/ossl_pkcs12.c:196:8: note: in expansion of macro ‘rb_scan_args’
ruby-3.4.2/include/ruby/internal/scan_args.h:422:15: note: in expansion of macro ‘rb_scan_args_next_param’
ruby-3.4.2/ext/openssl/ossl_pkcs12.c: scope_hint: In function ‘ossl_pkcs12_initialize’
ruby-3.4.2/include/ruby/internal/special_consts.h:55:25: note: in expansion of macro ‘RB_NIL_P’
ruby-3.4.2/ext/openssl/ossl_pkcs12.c:197:18: note: in expansion of macro ‘NIL_P’
ruby-3.4.2/include/ruby/internal/special_consts.h:55:25: note: in expansion of macro ‘RB_NIL_P’
ruby-3.4.2/ext/openssl/ossl_pkcs12.c:197:18: note: in expansion of macro ‘NIL_P’
# 73| #define RB_FLONUM_P RB_FLONUM_P
# 74| #define RB_IMMEDIATE_P RB_IMMEDIATE_P
# 75|-> #define RB_NIL_P RB_NIL_P
# 76| #define RB_SPECIAL_CONST_P RB_SPECIAL_CONST_P
# 77| #define RB_STATIC_SYM_P RB_STATIC_SYM_P
Error: CPPCHECK_WARNING (CWE-252):
ruby-3.4.2/io.c:8415: error[leakReturnValNotUsed]: Return value of allocation function 'freopen' is not stored.
# 8413| rb_freopen(VALUE fname, const char *mode, FILE *fp)
# 8414| {
# 8415|-> if (!freopen(RSTRING_PTR(fname), mode, fp)) {
# 8416| RB_GC_GUARD(fname);
# 8417| return errno;
Error: CPPCHECK_WARNING (CWE-758):
ruby-3.4.2/io.c:8745: warning[objectIndex]: The address of variable 'line' might be accessed at non-zero index.
# 8743| rb_io_write(out, rb_output_fs);
# 8744| }
# 8745|-> rb_io_write(out, argv[i]);
# 8746| }
# 8747| if (argc > 0 && !NIL_P(rb_output_rs)) {
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/io_buffer.c:188: error[ctunullpointer]: Null pointer dereference: buffer
# 186| io_buffer_zero(struct rb_io_buffer *buffer)
# 187| {
# 188|-> buffer->base = NULL;
# 189| buffer->size = 0;
# 190| #if defined(_WIN32)
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/io_buffer.c:188: warning[nullPointer]: Possible null pointer dereference: buffer
# 186| io_buffer_zero(struct rb_io_buffer *buffer)
# 187| {
# 188|-> buffer->base = NULL;
# 189| buffer->size = 0;
# 190| #if defined(_WIN32)
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/io_buffer.c:189: warning[nullPointer]: Possible null pointer dereference: buffer
# 187| {
# 188| buffer->base = NULL;
# 189|-> buffer->size = 0;
# 190| #if defined(_WIN32)
# 191| buffer->mapping = NULL;
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/io_buffer.c:193: warning[nullPointer]: Possible null pointer dereference: buffer
# 191| buffer->mapping = NULL;
# 192| #endif
# 193|-> buffer->source = Qnil;
# 194| }
# 195|
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/iseq.c: scope_hint: In function ‘iseq_add_local_tracepoint’
ruby-3.4.2/iseq.c:3868:25: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
ruby-3.4.2/iseq.c: scope_hint: In function ‘iseq_add_local_tracepoint’
ruby-3.4.2/iseq.c: scope_hint: In function ‘iseq_add_local_tracepoint’
# 3866| for (pc=0; pc<body->iseq_size;) {
# 3867| const struct iseq_insn_info_entry *entry = get_insn_info(iseq, pc);
# 3868|-> rb_event_flag_t pc_events = entry->events;
# 3869| rb_event_flag_t target_events = turnon_events;
# 3870| unsigned int line = (int)entry->line_no;
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/memory_view.c: scope_hint: In function ‘get_format_size’
ruby-3.4.2/memory_view.c:275:24: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘error’
ruby-3.4.2/include/ruby/ruby.h:30: included_from: Included from here.
ruby-3.4.2/internal.h:31: included_from: Included from here.
ruby-3.4.2/memory_view.c:9: included_from: Included from here.
ruby-3.4.2/memory_view.c:412:20: note: in expansion of macro ‘ISSPACE’
ruby-3.4.2/include/ruby/internal/assume.h:29: included_from: Included from here.
ruby-3.4.2/include/ruby/backward/2/assume.h:24: included_from: Included from here.
ruby-3.4.2/include/ruby/defines.h:72: included_from: Included from here.
ruby-3.4.2/include/ruby/ruby.h:25: included_from: Included from here.
ruby-3.4.2/include/ruby/internal/cast.h:31:29: note: in definition of macro ‘RBIMPL_CAST’
ruby-3.4.2/include/ruby/internal/memory.h:399:20: note: in expansion of macro ‘RB_ALLOC_N’
ruby-3.4.2/memory_view.c:444:48: note: in expansion of macro ‘ALLOC_N’
# 273| }
# 274| if (*endianness != ENDIANNESS_NATIVE) {
# 275|-> *error = rb_exc_new_cstr(rb_eArgError, "Unable to use both '<' and '>' multiple times");
# 276| return -1;
# 277| }
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/missing/dtoa.c:580: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rv
# 578| rv = (Bigint*)MALLOC(len*sizeof(double));
# 579| #endif
# 580|-> rv->k = k;
# 581| rv->maxwds = x;
# 582| }
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/util.c:639: included_from: Included from here.
ruby-3.4.2/missing/dtoa.c: scope_hint: In function ‘Balloc’
ruby-3.4.2/missing/dtoa.c:580:15: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘rv’
ruby-3.4.2/missing/dtoa.c:2644:1: note: in expansion of macro ‘dtoa’
ruby-3.4.2/missing/dtoa.c:2735:10: note: in expansion of macro ‘dval’
ruby-3.4.2/missing/dtoa.c:578:27: note: in expansion of macro ‘MALLOC’
# 578| rv = (Bigint*)MALLOC(len*sizeof(double));
# 579| #endif
# 580|-> rv->k = k;
# 581| rv->maxwds = x;
# 582| }
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/missing/dtoa.c:581: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rv
# 579| #endif
# 580| rv->k = k;
# 581|-> rv->maxwds = x;
# 582| }
# 583| FREE_DTOA_LOCK(0);
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/missing/dtoa.c:584: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: rv
# 582| }
# 583| FREE_DTOA_LOCK(0);
# 584|-> rv->sign = rv->wds = 0;
# 585| return rv;
# 586| }
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/missing/dtoa.c:2583: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: t
# 2581|
# 2582| t = rv = rv_alloc(n);
# 2583|-> while ((*t = *s++) != 0) t++;
# 2584| if (rve)
# 2585| *rve = t;
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/missing/dtoa.c: scope_hint: In function ‘nrv_alloc’
ruby-3.4.2/missing/dtoa.c:2583:16: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘t’
ruby-3.4.2/missing/dtoa.c:3382:1: note: in expansion of macro ‘hdtoa’
ruby-3.4.2/missing/dtoa.c:3400:20: note: in expansion of macro ‘rv_strdup’
ruby-3.4.2/missing/dtoa.c:2574:21: note: in expansion of macro ‘MALLOC’
ruby-3.4.2/missing/dtoa.c:2582:14: note: in expansion of macro ‘rv_alloc’
# 2581|
# 2582| t = rv = rv_alloc(n);
# 2583|-> while ((*t = *s++) != 0) t++;
# 2584| if (rve)
# 2585| *rve = t;
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/missing/dtoa.c:3440: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: s0
# 3438| manh = dmanh_get(u);
# 3439| manl = dmanl_get(u);
# 3440|-> *s0 = '1';
# 3441| for (s = s0 + 1; s < s0 + bufsize; s++) {
# 3442| *s = xdigs[(manh >> (DBL_MANH_SIZE - 4)) & 0xf];
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/missing/dtoa.c: scope_hint: In function ‘ruby_hdtoa’
ruby-3.4.2/missing/dtoa.c:3440:13: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘s0’
ruby-3.4.2/missing/dtoa.c:3351:28: note: in expansion of macro ‘word0’
ruby-3.4.2/missing/dtoa.c:3410:18: note: in expansion of macro ‘dexp_get’
ruby-3.4.2/missing/dtoa.c:2574:21: note: in expansion of macro ‘MALLOC’
ruby-3.4.2/missing/dtoa.c:3426:14: note: in expansion of macro ‘rv_alloc’
# 3438| manh = dmanh_get(u);
# 3439| manl = dmanl_get(u);
# 3440|-> *s0 = '1';
# 3441| for (s = s0 + 1; s < s0 + bufsize; s++) {
# 3442| *s = xdigs[(manh >> (DBL_MANH_SIZE - 4)) & 0xf];
Error: CPPCHECK_WARNING (CWE-682):
ruby-3.4.2/missing/dtoa.c:3441: error[nullPointerArithmeticOutOfMemory]: If memory allocation fail: pointer addition with NULL pointer.
# 3439| manl = dmanl_get(u);
# 3440| *s0 = '1';
# 3441|-> for (s = s0 + 1; s < s0 + bufsize; s++) {
# 3442| *s = xdigs[(manh >> (DBL_MANH_SIZE - 4)) & 0xf];
# 3443| manh = (manh << 4) | (manl >> (DBL_MANL_SIZE - 4));
Error: GCC_ANALYZER_WARNING (CWE-457):
ruby-3.4.2/missing/dtoa.c:3449:43: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*<unknown>’
ruby-3.4.2/missing/dtoa.c:3351:28: note: in expansion of macro ‘word0’
ruby-3.4.2/missing/dtoa.c:3410:18: note: in expansion of macro ‘dexp_get’
ruby-3.4.2/missing/dtoa.c:3411:22: note: in expansion of macro ‘dexp_get’
ruby-3.4.2/missing/dtoa.c:2574:21: note: in expansion of macro ‘MALLOC’
ruby-3.4.2/missing/dtoa.c:3426:14: note: in expansion of macro ‘rv_alloc’
ruby-3.4.2/missing/dtoa.c:3353:34: note: in expansion of macro ‘word0’
ruby-3.4.2/missing/dtoa.c:3438:16: note: in expansion of macro ‘dmanh_get’
# 3447| /* If ndigits < 0, we are expected to auto-size the precision. */
# 3448| if (ndigits < 0) {
# 3449|-> for (ndigits = SIGFIGS; s0[ndigits - 1] == '0'; ndigits--)
# 3450| ;
# 3451| }
Error: CPPCHECK_WARNING (CWE-457):
ruby-3.4.2/prism/encoding.c:2269: error[legacyUninitvar]: Uninitialized variable: codepoint
# 2267|
# 2268| codepoint = (state != 0) ?
# 2269|-> (byte & 0x3fu) | (codepoint << 6) :
# 2270| (0xffu >> type) & (byte);
# 2271|
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/prism/prism.c:2917: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: memory
# 2915|
# 2916| void *memory = xmalloc(length);
# 2917|-> memcpy(memory, write_constant->start, length);
# 2918|
# 2919| *read_name = pm_constant_pool_insert_owned(&parser->constant_pool, (uint8_t *) memory, length);
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/prism/prism.c:4119: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buffer
# 4117| // Next, handle underscores by removing them from the buffer.
# 4118| for (size_t index = 0; index < length; index++) {
# 4119|-> if (buffer[index] == '_') {
# 4120| memmove((void *) (buffer + index), (void *) (buffer + index + 1), length - index);
# 4121| length--;
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/prism/prism.c:4126: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buffer
# 4124|
# 4125| // Null-terminate the buffer so that strtod cannot read off the end.
# 4126|-> buffer[length] = '\0';
# 4127|
# 4128| // Now, call strtod to parse the value. Note that CRuby has their own
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/prism/prism.c:4134: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buffer
# 4132| errno = 0;
# 4133| char *eptr;
# 4134|-> double value = strtod(buffer, &eptr);
# 4135|
# 4136| // This should never happen, because we've already checked that the token
Error: CPPCHECK_WARNING (CWE-682):
ruby-3.4.2/prism/prism.c:4138: error[nullPointerArithmeticOutOfMemory]: If memory allocation fail: pointer addition with NULL pointer.
# 4136| // This should never happen, because we've already checked that the token
# 4137| // is in a valid format. However it's good to be safe.
# 4138|-> if ((eptr != buffer + length) || (errno != 0 && errno != ERANGE)) {
# 4139| PM_PARSER_ERR_TOKEN_FORMAT_CONTENT(parser, (*token), PM_ERR_FLOAT_PARSE);
# 4140| xfree((void *) buffer);
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/prism/prism.c:6166: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: digits
# 6164|
# 6165| char *digits = xcalloc(length + 1, sizeof(char));
# 6166|-> memcpy(digits, start, length);
# 6167| digits[length] = '\0';
# 6168|
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/prism/prism.c:6167: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: digits
# 6165| char *digits = xcalloc(length + 1, sizeof(char));
# 6166| memcpy(digits, start, length);
# 6167|-> digits[length] = '\0';
# 6168|
# 6169| char *endptr;
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/prism/prism.c:6171: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: digits
# 6169| char *endptr;
# 6170| errno = 0;
# 6171|-> unsigned long value = strtoul(digits, &endptr, 10);
# 6172|
# 6173| if ((digits == endptr) || (*endptr != '\0')) {
Error: CPPCHECK_WARNING (CWE-758):
ruby-3.4.2/prism/util/pm_buffer.c:162: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 160| void
# 161| pm_buffer_append_varsint(pm_buffer_t *buffer, int32_t value) {
# 162|-> uint32_t unsigned_int = ((uint32_t)(value) << 1) ^ ((uint32_t)(value >> 31));
# 163| pm_buffer_append_varuint(buffer, unsigned_int);
# 164| }
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/prism/util/pm_integer.c:89: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: values
# 87| }
# 88|
# 89|-> while (a_length > 1 && values[a_length - 1] == 0) a_length--;
# 90| *destination = (pm_integer_t) { a_length, values, 0, false };
# 91| }
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/prism/util/pm_integer.c:163: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: values
# 161| uint32_t carry = 0;
# 162| for (size_t index = 0; index < product.length; index++) {
# 163|-> uint64_t sum = (uint64_t) values[start_offset + index] + product.values[index] + carry;
# 164| values[start_offset + index] = (uint32_t) (sum % base);
# 165| carry = (uint32_t) (sum / base);
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/prism/util/pm_integer.c:164: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: values
# 162| for (size_t index = 0; index < product.length; index++) {
# 163| uint64_t sum = (uint64_t) values[start_offset + index] + product.values[index] + carry;
# 164|-> values[start_offset + index] = (uint32_t) (sum % base);
# 165| carry = (uint32_t) (sum / base);
# 166| }
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/prism/util/pm_integer.c:206: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: values
# 204|
# 205| assert(z0.values != NULL);
# 206|-> memcpy(values, z0.values, sizeof(uint32_t) * z0.length);
# 207|
# 208| assert(z2.values != NULL);
Error: CPPCHECK_WARNING (CWE-682):
ruby-3.4.2/prism/util/pm_integer.c:209: error[nullPointerArithmeticOutOfMemory]: If memory allocation fail: pointer addition with NULL pointer.
# 207|
# 208| assert(z2.values != NULL);
# 209|-> memcpy(values + 2 * half, z2.values, sizeof(uint32_t) * z2.length);
# 210|
# 211| uint32_t carry = 0;
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/prism/util/pm_integer.c:213: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: values
# 211| uint32_t carry = 0;
# 212| for(size_t index = 0; index < z1.length; index++) {
# 213|-> uint64_t sum = (uint64_t) carry + values[index + half] + z1.values[index];
# 214| values[index + half] = (uint32_t) (sum % base);
# 215| carry = (uint32_t) (sum / base);
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/prism/util/pm_integer.c:214: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: values
# 212| for(size_t index = 0; index < z1.length; index++) {
# 213| uint64_t sum = (uint64_t) carry + values[index + half] + z1.values[index];
# 214|-> values[index + half] = (uint32_t) (sum % base);
# 215| carry = (uint32_t) (sum / base);
# 216| }
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/prism/util/pm_integer.c:219: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: values
# 217|
# 218| for(size_t index = half + z1.length; carry > 0; index++) {
# 219|-> uint64_t sum = (uint64_t) carry + values[index];
# 220| values[index] = (uint32_t) (sum % base);
# 221| carry = (uint32_t) (sum / base);
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/prism/util/pm_integer.c:220: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: values
# 218| for(size_t index = half + z1.length; carry > 0; index++) {
# 219| uint64_t sum = (uint64_t) carry + values[index];
# 220|-> values[index] = (uint32_t) (sum % base);
# 221| carry = (uint32_t) (sum / base);
# 222| }
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/prism/util/pm_integer.c:224: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: values
# 222| }
# 223|
# 224|-> while (length > 1 && values[length - 1] == 0) length--;
# 225| pm_integer_free(&z0);
# 226| pm_integer_free(&z1);
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/prism/util/pm_integer.c:410: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: values
# 408| size_t shift = bit_position % 32;
# 409|
# 410|-> values[index] |= value << shift;
# 411| if (32 - shift < bit) values[index + 1] |= value >> (32 - shift);
# 412| }
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/prism/util/pm_integer.c:414: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: values
# 412| }
# 413|
# 414|-> while (length > 1 && values[length - 1] == 0) length--;
# 415| *integer = (pm_integer_t) { .length = length, .values = values, .value = 0, .negative = false };
# 416| pm_integer_normalize(integer);
Error: CPPCHECK_WARNING (CWE-758):
ruby-3.4.2/prism_compile.c:1712: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 1710| }
# 1711| else {
# 1712|-> pm_local_index_t index = pm_lookup_local_index(iseq, scope_node, PM_CONSTANT_MULT, 0);
# 1713| PUSH_GETLOCAL(ret, location, index.index, index.level);
# 1714| }
Error: CPPCHECK_WARNING (CWE-758):
ruby-3.4.2/prism_compile.c:1758: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 1756| *flags |= VM_CALL_FORWARDING;
# 1757|
# 1758|-> pm_local_index_t mult_local = pm_lookup_local_index(iseq, scope_node, PM_CONSTANT_DOT3, 0);
# 1759| PUSH_GETLOCAL(ret, location, mult_local.index, mult_local.level);
# 1760|
Error: CPPCHECK_WARNING (CWE-758):
ruby-3.4.2/prism_compile.c:1773: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 1771| //
# 1772| // Push the *
# 1773|-> pm_local_index_t mult_local = pm_lookup_local_index(iseq, scope_node, PM_CONSTANT_MULT, 0);
# 1774| PUSH_GETLOCAL(ret, location, mult_local.index, mult_local.level);
# 1775| PUSH_INSN1(ret, location, splatarray, Qtrue);
Error: CPPCHECK_WARNING (CWE-758):
ruby-3.4.2/prism_compile.c:1778: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 1776|
# 1777| // Push the **
# 1778|-> pm_local_index_t pow_local = pm_lookup_local_index(iseq, scope_node, PM_CONSTANT_POW, 0);
# 1779| PUSH_GETLOCAL(ret, location, pow_local.index, pow_local.level);
# 1780|
Error: CPPCHECK_WARNING (CWE-758):
ruby-3.4.2/prism_compile.c:1782: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 1780|
# 1781| // Push the &
# 1782|-> pm_local_index_t and_local = pm_lookup_local_index(iseq, scope_node, PM_CONSTANT_AND, 0);
# 1783| PUSH_INSN2(ret, location, getblockparamproxy, INT2FIX(and_local.index + VM_ENV_DATA_SIZE - 1), INT2FIX(and_local.level));
# 1784| PUSH_INSN(ret, location, splatkw);
Error: CPPCHECK_WARNING (CWE-758):
ruby-3.4.2/prism_compile.c:4622: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 4620| {
# 4621| local_table_for_iseq->ids[local_index] = local_name;
# 4622|-> st_insert(index_lookup_table, (st_data_t) (local_name | PM_SPECIAL_CONSTANT_FLAG), (st_data_t) local_index);
# 4623| }
# 4624|
Error: CPPCHECK_WARNING (CWE-758):
ruby-3.4.2/prism_compile.c:7101: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 7099| }
# 7100| else {
# 7101|-> pm_local_index_t index = pm_lookup_local_index(iseq, scope_node, PM_CONSTANT_MULT, 0);
# 7102| PUSH_GETLOCAL(ret, *location, index.index, index.level);
# 7103| }
Error: CPPCHECK_WARNING (CWE-758):
ruby-3.4.2/prism_compile.c:7935: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 7933| if (ISEQ_BODY(ISEQ_BODY(iseq)->local_iseq)->param.flags.forwardable) {
# 7934| flag |= VM_CALL_FORWARDING;
# 7935|-> pm_local_index_t mult_local = pm_lookup_local_index(iseq, scope_node, PM_CONSTANT_DOT3, 0);
# 7936| PUSH_GETLOCAL(ret, *location, mult_local.index, mult_local.level);
# 7937|
Error: CPPCHECK_WARNING (CWE-758):
ruby-3.4.2/prism_compile.c:8676: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 8674| }
# 8675| else if (!popped) {
# 8676|-> pm_local_index_t index = pm_lookup_local_index(iseq, scope_node, PM_CONSTANT_POW, 0);
# 8677| PUSH_GETLOCAL(ret, location, index.index, index.level);
# 8678| }
Error: CPPCHECK_WARNING (CWE-758):
ruby-3.4.2/prism_compile.c:8729: error[shiftTooManyBitsSigned]: Shifting signed 32-bit value by 31 bits is undefined behaviour
# 8727| else {
# 8728| // If there's no expression, this must be block forwarding.
# 8729|-> pm_local_index_t local_index = pm_lookup_local_index(iseq, scope_node, PM_CONSTANT_AND, 0);
# 8730| PUSH_INSN2(ret, location, getblockparamproxy, INT2FIX(local_index.index + VM_ENV_DATA_SIZE - 1), INT2FIX(local_index.level));
# 8731| }
Error: CPPCHECK_WARNING (CWE-562):
ruby-3.4.2/prism_compile.c:10439: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
#10437| // added to the "pre" anchor.
#10438| DECL_ANCHOR(pre);
#10439|-> node->pre_execution_anchor = pre;
#10440|
#10441| // Now we'll compile the body as normal. We won't compile directly into
Error: CPPCHECK_WARNING (CWE-190):
ruby-3.4.2/proc.c:434: error[integerOverflow]: Signed integer overflow for expression '-3'.
# 432|
# 433| *envp = env;
# 434|-> unsigned int last_lvar = env->env_size+VM_ENV_INDEX_LAST_LVAR
# 435| - 1 /* errinfo */;
# 436| return &env->env[last_lvar - (local_table_size - i)];
Error: CPPCHECK_WARNING (CWE-758):
ruby-3.4.2/process.c:1651: error[missingReturn]: Found an exit path from function with non-void return type that has missing return statement
# 1649| return 0;
# 1650| #endif
# 1651|-> }
# 1652|
# 1653| static void
Error: CPPCHECK_WARNING (CWE-457):
ruby-3.4.2/process.c:3314: error[uninitvar]: Uninitialized variables: &key.newfd, &key.older_index, &key.num_newer, &key.cloexec
# 3312| struct run_exec_dup2_fd_pair key, *found;
# 3313| key.oldfd = newfd;
# 3314|-> found = bsearch(&key, pairs, n, sizeof(struct run_exec_dup2_fd_pair), intcmp); /* hopefully async-signal-safe */
# 3315| pairs[i].num_newer = 0;
# 3316| if (found) {
Error: CPPCHECK_WARNING (CWE-457):
ruby-3.4.2/process.c:5470: error[uninitvar]: Uninitialized variable: resource
# 5468| rb_bug("unexpected casetype");
# 5469| }
# 5470|-> return resource;
# 5471| #undef RESCHECK
# 5472| }
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/ractor.c:1525: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: config
# 1523| struct rb_ractor_selector_take_config *config = malloc(sizeof(struct rb_ractor_selector_take_config));
# 1524| VM_ASSERT(config != NULL);
# 1525|-> config->closed = false;
# 1526| config->oneshot = false;
# 1527|
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/ractor.c:1526: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: config
# 1524| VM_ASSERT(config != NULL);
# 1525| config->closed = false;
# 1526|-> config->oneshot = false;
# 1527|
# 1528| if (ractor_register_take(GET_RACTOR(), r, &s->take_basket, false, config, true)) {
Error: CPPCHECK_WARNING (CWE-457):
ruby-3.4.2/random.c:752: warning[uninitvar]: Uninitialized variable: v
# 750| v = make_seed_value(seedbuf, DEFAULT_SEED_CNT);
# 751| }
# 752|-> return v;
# 753| }
# 754|
Error: CPPCHECK_WARNING (CWE-457):
ruby-3.4.2/re.c:329: warning[uninitvar]: Uninitialized variable: str
# 327| if (options & ONIG_OPTION_EXTEND) *p++ = 'x';
# 328| *p = 0;
# 329|-> return str;
# 330| }
# 331|
Error: CPPCHECK_WARNING (CWE-457):
ruby-3.4.2/re.c:1069: warning[uninitvar]: Uninitialized variable: &key.char_pos
# 1067|
# 1068| key.byte_pos = BEG(i);
# 1069|-> found = bsearch(&key, pairs, num_pos, sizeof(pair_t), pair_byte_cmp);
# 1070| rm->char_offset[i].beg = found->char_pos;
# 1071|
Error: CPPCHECK_WARNING (CWE-401):
ruby-3.4.2/regcomp.c:188: error[memleak]: Memory leak: p
# 186|
# 187| p = (UnsetAddr* )xmalloc(sizeof(UnsetAddr)* size);
# 188|-> CHECK_NULL_RETURN_MEMERR(p);
# 189| uslist->num = 0;
# 190| uslist->alloc = size;
Error: CPPCHECK_WARNING (CWE-401):
ruby-3.4.2/regcomp.c:210: error[memleak]: Memory leak: p
# 208| size = uslist->alloc * 2;
# 209| p = (UnsetAddr* )xrealloc(uslist->us, sizeof(UnsetAddr) * size);
# 210|-> CHECK_NULL_RETURN_MEMERR(p);
# 211| uslist->alloc = size;
# 212| uslist->us = p;
Error: CPPCHECK_WARNING (CWE-401):
ruby-3.4.2/regcomp.c:673: error[memleak]: Memory leak: p
# 671| if (reg->repeat_range_alloc == 0) {
# 672| p = (OnigRepeatRange* )xmalloc(sizeof(OnigRepeatRange) * REPEAT_RANGE_ALLOC);
# 673|-> CHECK_NULL_RETURN_MEMERR(p);
# 674| reg->repeat_range = p;
# 675| reg->repeat_range_alloc = REPEAT_RANGE_ALLOC;
Error: CPPCHECK_WARNING (CWE-401):
ruby-3.4.2/regcomp.c:682: error[memleak]: Memory leak: p
# 680| p = (OnigRepeatRange* )xrealloc(reg->repeat_range,
# 681| sizeof(OnigRepeatRange) * n);
# 682|-> CHECK_NULL_RETURN_MEMERR(p);
# 683| reg->repeat_range = p;
# 684| reg->repeat_range_alloc = n;
Error: CPPCHECK_WARNING (CWE-401):
ruby-3.4.2/regcomp.c:3419: error[memleak]: Memory leak: sbuf
# 3417| sbuf_size = (end - sn->s) * 2;
# 3418| sbuf = (UChar* )xmalloc(sbuf_size);
# 3419|-> CHECK_NULL_RETURN_MEMERR(sbuf);
# 3420| ebuf = sbuf + sbuf_size;
# 3421|
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/rjit.c: scope_hint: In function ‘rjit_cme_invalidate.part.0’
ruby-3.4.2/rjit.c:180:41: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
ruby-3.4.2/rjit.c:211:34: note: in expansion of macro ‘WITH_RJIT_ISOLATED_USING_PC’
ruby-3.4.2/rjit.c:234:5: note: in expansion of macro ‘WITH_RJIT_ISOLATED’
ruby-3.4.2/rjit.c:211:34: note: in expansion of macro ‘WITH_RJIT_ISOLATED_USING_PC’
ruby-3.4.2/rjit.c:234:5: note: in expansion of macro ‘WITH_RJIT_ISOLATED’
ruby-3.4.2/rjit.h:13: included_from: Included from here.
ruby-3.4.2/rjit.c:9: included_from: Included from here.
ruby-3.4.2/rjit.c: scope_hint: In function ‘rjit_cme_invalidate.part.0’
ruby-3.4.2/rjit.c:211:34: note: in expansion of macro ‘WITH_RJIT_ISOLATED_USING_PC’
ruby-3.4.2/rjit.c:234:5: note: in expansion of macro ‘WITH_RJIT_ISOLATED’
ruby-3.4.2/rjit.c:211:34: note: in expansion of macro ‘WITH_RJIT_ISOLATED_USING_PC’
ruby-3.4.2/rjit.c:234:5: note: in expansion of macro ‘WITH_RJIT_ISOLATED’
# 178| \
# 179| rb_hook_list_t *global_hooks = rb_ec_ractor_hooks(GET_EC()); \
# 180|-> rb_rjit_global_events = global_hooks->events; \
# 181| \
# 182| const VALUE *pc = NULL; \
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/rjit_c.c: scope_hint: In function ‘rjit_build_kwhash’
ruby-3.4.2/rjit_c.c:196:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
ruby-3.4.2/rjit_c.h:10: included_from: Included from here.
ruby-3.4.2/rjit_c.c:13: included_from: Included from here.
ruby-3.4.2/rjit_c.c: scope_hint: In function ‘rjit_build_kwhash’
# 194| {
# 195| const struct rb_callinfo_kwarg *kw_arg = vm_ci_kwarg(ci);
# 196|-> int kw_len = kw_arg->keyword_len;
# 197| VALUE hash = rb_hash_new_with_size(kw_len);
# 198|
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/ruby.c: scope_hint: In function ‘ruby_push_include’
ruby-3.4.2/ruby.c:466:21: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘s’
ruby-3.4.2/include/ruby/ruby.h:42: included_from: Included from here.
ruby-3.4.2/eval_intern.h:4: included_from: Included from here.
ruby-3.4.2/ruby.c:44: included_from: Included from here.
ruby-3.4.2/ruby.c:920:5: note: in expansion of macro ‘MEMMOVE’
ruby-3.4.2/ruby.c: scope_hint: In function ‘ruby_push_include’
ruby-3.4.2/include/ruby/internal/memory.h:384:46: note: in definition of macro ‘MEMMOVE’
ruby-3.4.2/ruby.c:920:19: note: in expansion of macro ‘RSTRING_PTR’
ruby-3.4.2/ruby.c: scope_hint: In function ‘ruby_push_include’
ruby-3.4.2/ruby.c:1693:13: note: in expansion of macro ‘forbid_setid’
ruby-3.4.2/ruby.c:1693:13: note: in expansion of macro ‘forbid_setid’
ruby-3.4.2/ruby.c: scope_hint: In function ‘ruby_push_include’
ruby-3.4.2/ruby.c:466:49: note: in expansion of macro ‘CharNext’
ruby-3.4.2/ruby.c:466:49: note: in expansion of macro ‘CharNext’
ruby-3.4.2/ruby.c:466:49: note: in expansion of macro ‘CharNext’
# 464| p++;
# 465| if (!*p) break;
# 466|-> for (s = p; *s && !is_path_sep(*s); s = CharNext(s));
# 467| len = s - p;
# 468| #undef is_path_sep
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/ruby.c:894: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: s
# 892| const char *crash_report = opt->crash_report;
# 893|
# 894|-> while (ISSPACE(*s)) s++;
# 895| if (!*s) return;
# 896|
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/ruby.c:2136: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: switches
# 2134| char *switches = malloc(length + 1);
# 2135| memcpy(switches, source, length);
# 2136|-> switches[length] = '\0';
# 2137|
# 2138| int no_src_enc = !opt->src.enc.name;
Error: GCC_ANALYZER_WARNING (CWE-775):
ruby-3.4.2/ruby.c: scope_hint: In function ‘fill_standard_fds’
ruby-3.4.2/ruby.c:3206:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor
# 3204| }
# 3205| if (f1 || f2) {
# 3206|-> if (pipe(fds) == 0) {
# 3207| close(fds[0]);
# 3208| if (f1 && fds[1] != 1)
Error: GCC_ANALYZER_WARNING (CWE-775):
ruby-3.4.2/ruby.c: scope_hint: In function ‘fill_standard_fds’
ruby-3.4.2/ruby.c:3216:1: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘fds[0]’
# 3214| }
# 3215| }
# 3216|-> }
# 3217|
# 3218| void
Error: GCC_ANALYZER_WARNING (CWE-688):
ruby-3.4.2/ruby_parser.c:946:12: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘val’ where non-null expected
ruby-3.4.2/ruby_parser.c: scope_hint: In function ‘rational_value’
ruby-3.4.2/include/ruby/intern.h:50: included_from: Included from here.
ruby-3.4.2/include/ruby/ruby.h:194: included_from: Included from here.
ruby-3.4.2/include/ruby/encoding.h:19: included_from: Included from here.
ruby-3.4.2/rubyparser.h:21: included_from: Included from here.
ruby-3.4.2/internal/parse.h:12: included_from: Included from here.
ruby-3.4.2/ruby_parser.c:3: included_from: Included from here.
ruby-3.4.2/ruby_parser.c:963:15: note: in expansion of macro ‘rb_rational_raw1’
ruby-3.4.2/include/ruby/intern.h:28: included_from: Included from here.
ruby-3.4.2/include/ruby/internal/intern/bignum.h: scope_hint: In function ‘rational_value’
ruby-3.4.2/include/ruby/internal/intern/bignum.h:125:7: note: argument 1 of ‘rb_cstr_to_inum’ must be non-null
# 944| integer_value(const char *val, int base)
# 945| {
# 946|-> return rb_cstr_to_inum(val, base, FALSE);
# 947| }
# 948|
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/ruby_parser.c:955: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: val
# 953| char* val = strdup(node_val);
# 954| if (seen_point > 0) {
# 955|-> int len = (int)(strlen(val));
# 956| char *point = &val[seen_point];
# 957| size_t fraclen = len-seen_point-1;
Error: GCC_ANALYZER_WARNING (CWE-688):
ruby-3.4.2/ruby_parser.c:955:25: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘val’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null
# 953| char* val = strdup(node_val);
# 954| if (seen_point > 0) {
# 955|-> int len = (int)(strlen(val));
# 956| char *point = &val[seen_point];
# 957| size_t fraclen = len-seen_point-1;
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/spec/ruby/optional/capi/ext/bignum_spec.c:75: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buf
# 73| for (i = 0; i < long_len; i++) {
# 74| #if SIZEOF_LONG == 8
# 75|-> buf[i] = 0xfedcba9876543210L;
# 76| #else
# 77| buf[i] = 0xfedcba98L;
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/spec/ruby/optional/capi/ext/bignum_spec.c: scope_hint: In function ‘bignum_spec_rb_big_pack_array’
ruby-3.4.2/spec/ruby/optional/capi/ext/bignum_spec.c:75:12: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘buf’
# 73| for (i = 0; i < long_len; i++) {
# 74| #if SIZEOF_LONG == 8
# 75|-> buf[i] = 0xfedcba9876543210L;
# 76| #else
# 77| buf[i] = 0xfedcba98L;
Error: GCC_ANALYZER_WARNING (CWE-688):
ruby-3.4.2/spec/ruby/optional/capi/ext/bignum_spec.c:81:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘buf’ where non-null expected
ruby-3.4.2/include/ruby/intern.h:28: included_from: Included from here.
ruby-3.4.2/include/ruby/ruby.h:194: included_from: Included from here.
ruby-3.4.2/include/ruby.h:38: included_from: Included from here.
ruby-3.4.2/spec/ruby/optional/capi/ext/bignum_spec.c:1: included_from: Included from here.
ruby-3.4.2/include/ruby/internal/intern/bignum.h:281:6: note: argument 2 of ‘rb_big_pack’ must be non-null
# 79| }
# 80|
# 81|-> rb_big_pack(val, buf, long_len);
# 82| for (i = 0; i < long_len; i++) {
# 83| rb_ary_store(ary, i, ULONG2NUM(buf[i]));
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/spec/ruby/optional/capi/ext/bignum_spec.c:83: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buf
# 81| rb_big_pack(val, buf, long_len);
# 82| for (i = 0; i < long_len; i++) {
# 83|-> rb_ary_store(ary, i, ULONG2NUM(buf[i]));
# 84| }
# 85| free(buf);
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/spec/ruby/optional/capi/ext/io_spec.c:384: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: io_encoding
# 382| io_encoding = (struct rb_io_encoding *) malloc(sizeof(struct rb_io_encoding));
# 383|
# 384|-> io_encoding->enc = rb_to_encoding(internal_encoding);
# 385| io_encoding->enc2 = rb_to_encoding(external_encoding);
# 386| io_encoding->ecflags = FIX2INT(ecflags);
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/spec/ruby/optional/capi/ext/io_spec.c: scope_hint: In function ‘io_spec_rb_io_open_descriptor’
ruby-3.4.2/spec/ruby/optional/capi/ext/io_spec.c:384:20: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘io_encoding’
# 382| io_encoding = (struct rb_io_encoding *) malloc(sizeof(struct rb_io_encoding));
# 383|
# 384|-> io_encoding->enc = rb_to_encoding(internal_encoding);
# 385| io_encoding->enc2 = rb_to_encoding(external_encoding);
# 386| io_encoding->ecflags = FIX2INT(ecflags);
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/spec/ruby/optional/capi/ext/io_spec.c:385: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: io_encoding
# 383|
# 384| io_encoding->enc = rb_to_encoding(internal_encoding);
# 385|-> io_encoding->enc2 = rb_to_encoding(external_encoding);
# 386| io_encoding->ecflags = FIX2INT(ecflags);
# 387| io_encoding->ecopts = ecopts;
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/spec/ruby/optional/capi/ext/io_spec.c:386: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: io_encoding
# 384| io_encoding->enc = rb_to_encoding(internal_encoding);
# 385| io_encoding->enc2 = rb_to_encoding(external_encoding);
# 386|-> io_encoding->ecflags = FIX2INT(ecflags);
# 387| io_encoding->ecopts = ecopts;
# 388|
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/spec/ruby/optional/capi/ext/io_spec.c:387: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: io_encoding
# 385| io_encoding->enc2 = rb_to_encoding(external_encoding);
# 386| io_encoding->ecflags = FIX2INT(ecflags);
# 387|-> io_encoding->ecopts = ecopts;
# 388|
# 389| return rb_io_open_descriptor(klass, FIX2INT(descriptor), FIX2INT(mode), path, timeout, io_encoding);
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/spec/ruby/optional/capi/ext/typed_data_spec.c:91: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: bar
# 89| struct sample_typed_wrapped_struct* bar;
# 90| bar = (struct sample_typed_wrapped_struct *) malloc(sizeof(struct sample_typed_wrapped_struct));
# 91|-> bar->foo = 42;
# 92| return TypedData_Wrap_Struct(klass, &sample_typed_wrapped_struct_data_type, bar);
# 93| }
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/spec/ruby/optional/capi/ext/typed_data_spec.c: scope_hint: In function ‘sdaf_alloc_typed_func’
ruby-3.4.2/spec/ruby/optional/capi/ext/typed_data_spec.c:91:12: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘bar’
# 89| struct sample_typed_wrapped_struct* bar;
# 90| bar = (struct sample_typed_wrapped_struct *) malloc(sizeof(struct sample_typed_wrapped_struct));
# 91|-> bar->foo = 42;
# 92| return TypedData_Wrap_Struct(klass, &sample_typed_wrapped_struct_data_type, bar);
# 93| }
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/spec/ruby/optional/capi/ext/typed_data_spec.c:105: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: bar
# 103| struct sample_typed_wrapped_struct* bar;
# 104| bar = (struct sample_typed_wrapped_struct *) malloc(sizeof(struct sample_typed_wrapped_struct));
# 105|-> bar->foo = FIX2INT(val);
# 106| return TypedData_Wrap_Struct(rb_cObject, &sample_typed_wrapped_struct_data_type, bar);
# 107| }
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/spec/ruby/optional/capi/ext/typed_data_spec.c: scope_hint: In function ‘sws_typed_wrap_struct’
ruby-3.4.2/spec/ruby/optional/capi/ext/typed_data_spec.c:105:12: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘bar’
# 103| struct sample_typed_wrapped_struct* bar;
# 104| bar = (struct sample_typed_wrapped_struct *) malloc(sizeof(struct sample_typed_wrapped_struct));
# 105|-> bar->foo = FIX2INT(val);
# 106| return TypedData_Wrap_Struct(rb_cObject, &sample_typed_wrapped_struct_data_type, bar);
# 107| }
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/spec/ruby/optional/capi/ext/typed_data_spec.c:113: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: data
# 111| VALUE sws_untyped_wrap_struct(VALUE self, VALUE val) {
# 112| int* data = (int*) malloc(sizeof(int));
# 113|-> *data = FIX2INT(val);
# 114| return Data_Wrap_Struct(rb_cObject, NULL, free, data);
# 115| }
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/spec/ruby/optional/capi/ext/typed_data_spec.c: scope_hint: In function ‘sws_untyped_wrap_struct’
ruby-3.4.2/spec/ruby/optional/capi/ext/typed_data_spec.c:113:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘data’
# 111| VALUE sws_untyped_wrap_struct(VALUE self, VALUE val) {
# 112| int* data = (int*) malloc(sizeof(int));
# 113|-> *data = FIX2INT(val);
# 114| return Data_Wrap_Struct(rb_cObject, NULL, free, data);
# 115| }
Error: CPPCHECK_WARNING (CWE-476):
ruby-3.4.2/spec/ruby/optional/capi/ext/typed_data_spec.c:153: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: new_struct
# 151| struct sample_typed_wrapped_struct *new_struct;
# 152| new_struct = (struct sample_typed_wrapped_struct *) malloc(sizeof(struct sample_typed_wrapped_struct));
# 153|-> new_struct->foo = FIX2INT(new_val);
# 154| free(RTYPEDDATA(obj)->data);
# 155| RTYPEDDATA(obj)->data = new_struct;
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/spec/ruby/optional/capi/ext/typed_data_spec.c: scope_hint: In function ‘sws_typed_change_struct’
ruby-3.4.2/spec/ruby/optional/capi/ext/typed_data_spec.c:153:19: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘new_struct’
# 151| struct sample_typed_wrapped_struct *new_struct;
# 152| new_struct = (struct sample_typed_wrapped_struct *) malloc(sizeof(struct sample_typed_wrapped_struct));
# 153|-> new_struct->foo = FIX2INT(new_val);
# 154| free(RTYPEDDATA(obj)->data);
# 155| RTYPEDDATA(obj)->data = new_struct;
Error: CPPCHECK_WARNING (CWE-562):
ruby-3.4.2/thread.c:1109: error[autoVariables]: Address of local auto-variable assigned to a function parameter.
# 1107| waiter.thread = th;
# 1108| waiter.fiber = rb_fiberptr_blocking(fiber) ? NULL : fiber;
# 1109|-> target_th->join_list = &waiter;
# 1110|
# 1111| struct join_arg arg;
Error: COMPILER_WARNING (CWE-569):
ruby-3.4.2/thread.c:271: included_from: Included from here.
ruby-3.4.2/thread_pthread.c: scope_hint: In function ‘native_thread_destroy’
ruby-3.4.2/thread_pthread.c:1783:30: warning[-Wtautological-compare]: self-comparison always evaluates to false
# 1783 | if (&nt->cond.readyq != &nt->cond.intr) {
# | ^~
# 1781| rb_native_cond_destroy(&nt->cond.readyq);
# 1782|
# 1783|-> if (&nt->cond.readyq != &nt->cond.intr) {
# 1784| rb_native_cond_destroy(&nt->cond.intr);
# 1785| }
Error: COMPILER_WARNING (CWE-569):
ruby-3.4.2/thread_pthread.c: scope_hint: In function ‘native_thread_setup’
ruby-3.4.2/thread_pthread.c:2105:26: warning[-Wtautological-compare]: self-comparison always evaluates to false
# 2105 | if (&nt->cond.readyq != &nt->cond.intr) {
# | ^~
# 2103| rb_native_cond_initialize(&nt->cond.readyq);
# 2104|
# 2105|-> if (&nt->cond.readyq != &nt->cond.intr) {
# 2106| rb_native_cond_initialize(&nt->cond.intr);
# 2107| }
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/thread_pthread.c:2815: included_from: Included from here.
ruby-3.4.2/thread.c:271: included_from: Included from here.
ruby-3.4.2/thread_pthread_mn.c: scope_hint: In function ‘timer_thread_register_waiting’
ruby-3.4.2/thread_pthread_mn.c:704:15: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘rel’
# 702| if (flags & thread_sched_waiting_timeout) {
# 703| VM_ASSERT(rel != NULL);
# 704|-> abs = rb_hrtime_add(rb_hrtime_now(), *rel);
# 705| }
# 706|
Error: CPPCHECK_WARNING (CWE-457):
ruby-3.4.2/time.c:2459: error[uninitvar]: Uninitialized variables: vtm.utc_offset, vtm.isdst, vtm.tzmode, vtm.tm_got
# 2457| }
# 2458|
# 2459|-> return time_init_vtm(time, vtm, zone);
# 2460| }
# 2461|
Error: CPPCHECK_WARNING (CWE-457):
ruby-3.4.2/transcode.c:1498: warning[uninitvar]: Uninitialized variable: input_stop
# 1496|
# 1497| resume:
# 1498|-> ret = rb_econv_convert0(ec, input_ptr, input_stop, output_ptr, output_stop, flags);
# 1499|
# 1500| if (ret == econv_invalid_byte_sequence ||
Error: CPPCHECK_WARNING (CWE-457):
ruby-3.4.2/variable.c:2598: error[uninitvar]: Uninitialized variable: autoload_data
# 2596| ccan_list_head_init(&autoload_data->constants);
# 2597|
# 2598|-> if (autoload_data_pointer) *autoload_data_pointer = autoload_data;
# 2599|
# 2600| rb_hash_aset(autoload_features, feature, autoload_data_value);
Error: GCC_ANALYZER_WARNING (CWE-787):
ruby-3.4.2/version.c: scope_hint: In function ‘define_ruby_description’
ruby-3.4.2/version.c:188:31: warning[-Wanalyzer-out-of-bounds]: buffer overflow
ruby-3.4.2/version.c:189:19: note: in expansion of macro ‘append’
ruby-3.4.2/version.c:189:19: note: in expansion of macro ‘append’
ruby-3.4.2/version.c:189:19: note: in expansion of macro ‘append’
ruby-3.4.2/version.c:188:31: note: write of 43 bytes to beyond the end of ‘desc’
ruby-3.4.2/version.c:189:19: note: in expansion of macro ‘append’
ruby-3.4.2/version.c:188:31: note: valid subscripts for ‘desc’ are ‘[0]’ to ‘[75]’
ruby-3.4.2/version.c:189:19: note: in expansion of macro ‘append’
ruby-3.4.2/include/ruby/defines.h:39: included_from: Included from here.
ruby-3.4.2/include/ruby/ruby.h:25: included_from: Included from here.
ruby-3.4.2/internal.h:31: included_from: Included from here.
ruby-3.4.2/vm_core.h:118: included_from: Included from here.
ruby-3.4.2/rjit.h:13: included_from: Included from here.
ruby-3.4.2/internal/cmdlineopt.h:4: included_from: Included from here.
ruby-3.4.2/version.c:12: included_from: Included from here.
/usr/include/string.h:506:15: note: parameter 1 of ‘strlcpy’ marked with attribute ‘access (write_only, 1, 3)’
# 186| int n = ruby_description_opt_point;
# 187| memcpy(desc, ruby_description, n);
# 188|-> # define append(s) (n += (int)strlcpy(desc + n, s, sizeof(desc) - n))
# 189| if (*jit_opt) append(jit_opt);
# 190| RUBY_ASSERT(n <= ruby_description_opt_point + (int)rb_strlen_lit(YJIT_DESCRIPTION));
Error: CPPCHECK_WARNING (CWE-457):
ruby-3.4.2/vm_backtrace.c:1645: warning[uninitvar]: Uninitialized variable: result
# 1643| }
# 1644|
# 1645|-> return result;
# 1646| }
# 1647|
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/include/ruby/defines.h:72: included_from: Included from here.
ruby-3.4.2/include/ruby/ruby.h:25: included_from: Included from here.
ruby-3.4.2/eval_intern.h:4: included_from: Included from here.
ruby-3.4.2/cont.c:28: included_from: Included from here.
ruby-3.4.2/cont.c: scope_hint: In function ‘fiber_switch’
ruby-3.4.2/vm_core.h:2166:30: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
ruby-3.4.2/include/ruby/backward/2/assume.h:50:46: note: in definition of macro ‘RB_UNLIKELY’
ruby-3.4.2/vm_core.h:2166:9: note: in expansion of macro ‘UNLIKELY’
ruby-3.4.2/vm_core.h:2208:3: note: in expansion of macro ‘EXEC_EVENT_HOOK_ORIG’
ruby-3.4.2/cont.c:2693:5: note: in expansion of macro ‘EXEC_EVENT_HOOK’
ruby-3.4.2/cont.c:3152:14: note: in expansion of macro ‘FIBER_SUSPENDED_P’
ruby-3.4.2/cont.c: scope_hint: In function ‘fiber_switch’
ruby-3.4.2/cont.c:2630:9: note: in expansion of macro ‘FIBER_TERMINATED_P’
ruby-3.4.2/cont.c: scope_hint: In function ‘fiber_switch’
ruby-3.4.2/eval_intern.h:5: included_from: Included from here.
ruby-3.4.2/vm_core.h:2165:35: note: in definition of macro ‘EXEC_EVENT_HOOK_ORIG’
ruby-3.4.2/cont.c:2693:5: note: in expansion of macro ‘EXEC_EVENT_HOOK’
ruby-3.4.2/cont.c: scope_hint: In function ‘fiber_switch’
ruby-3.4.2/include/ruby/backward/2/assume.h:50:46: note: in definition of macro ‘RB_UNLIKELY’
ruby-3.4.2/vm_core.h:2166:9: note: in expansion of macro ‘UNLIKELY’
ruby-3.4.2/vm_core.h:2208:3: note: in expansion of macro ‘EXEC_EVENT_HOOK_ORIG’
ruby-3.4.2/cont.c:2693:5: note: in expansion of macro ‘EXEC_EVENT_HOOK’
# 2164| const rb_event_flag_t flag_arg_ = (flag_); \
# 2165| rb_hook_list_t *hooks_arg_ = (hooks_); \
# 2166|-> if (UNLIKELY((hooks_arg_)->events & (flag_arg_))) { \
# 2167| /* defer evaluating the other arguments */ \
# 2168| rb_exec_event_hook_orig(ec_, hooks_arg_, flag_arg_, self_, id_, called_id_, klass_, data_, pop_p_); \
Error: GCC_ANALYZER_WARNING (CWE-775):
ruby-3.4.2/vm_dump.c: scope_hint: In function ‘rb_vm_bugreport’
ruby-3.4.2/vm_dump.c:50:25: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen("/proc/self/maps", "r")’
ruby-3.4.2/vm_dump.c:1220:17: note: in expansion of macro ‘kprintf’
ruby-3.4.2/vm_dump.c:1153:5: note: in expansion of macro ‘kprintf’
ruby-3.4.2/vm_dump.c:1158:5: note: in expansion of macro ‘kprintf’
ruby-3.4.2/vm_dump.c:1162:9: note: in expansion of macro ‘kprintf’
ruby-3.4.2/vm_dump.c:1162:9: note: in expansion of macro ‘kprintf’
ruby-3.4.2/vm_dump.c:1220:17: note: in expansion of macro ‘kprintf’
ruby-3.4.2/vm_dump.c:1220:17: note: in expansion of macro ‘kprintf’
# 48| int ruby_on_ci;
# 49|
# 50|-> #define kprintf(...) if (fprintf(errout, __VA_ARGS__) < 0) goto error
# 51| #define kputs(s) if (fputs(s, errout) < 0) goto error
# 52|
Error: GCC_ANALYZER_WARNING (CWE-401):
ruby-3.4.2/vm_dump.c:50:25: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen("/proc/self/maps", "r")’
ruby-3.4.2/vm_dump.c:1220:17: note: in expansion of macro ‘kprintf’
ruby-3.4.2/vm_dump.c:1153:5: note: in expansion of macro ‘kprintf’
ruby-3.4.2/vm_dump.c:1158:5: note: in expansion of macro ‘kprintf’
ruby-3.4.2/vm_dump.c:1162:9: note: in expansion of macro ‘kprintf’
ruby-3.4.2/vm_dump.c:1162:9: note: in expansion of macro ‘kprintf’
ruby-3.4.2/vm_dump.c:1220:17: note: in expansion of macro ‘kprintf’
ruby-3.4.2/vm_dump.c:1220:17: note: in expansion of macro ‘kprintf’
# 48| int ruby_on_ci;
# 49|
# 50|-> #define kprintf(...) if (fprintf(errout, __VA_ARGS__) < 0) goto error
# 51| #define kputs(s) if (fputs(s, errout) < 0) goto error
# 52|
Error: GCC_ANALYZER_WARNING (CWE-835):
ruby-3.4.2/vm_sync.c: scope_hint: In function ‘rb_ec_vm_lock_rec_release’
ruby-3.4.2/vm_sync.c:244:34: warning[-Wanalyzer-infinite-loop]: infinite loop
ruby-3.4.2/vm_sync.c:4: included_from: Included from here.
ruby-3.4.2/vm_sync.c:245:13: note: in expansion of macro ‘RB_VM_LOCK_LEAVE_LEV’
ruby-3.4.2/internal.h:18:19: note: in expansion of macro ‘RB_LIKELY’
ruby-3.4.2/vm_sync.h:40:9: note: in expansion of macro ‘LIKELY’
# 242| }
# 243| else {
# 244|-> while (recorded_lock_rec < current_lock_rec) {
# 245| RB_VM_LOCK_LEAVE_LEV(¤t_lock_rec);
# 246| }
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/vm_trace.c:170:21: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
ruby-3.4.2/vm_trace.c: scope_hint: In function ‘connect_event_hook’
ruby-3.4.2/eval_intern.h:5: included_from: Included from here.
ruby-3.4.2/vm_trace.c:24: included_from: Included from here.
ruby-3.4.2/vm_trace.c: scope_hint: In function ‘connect_event_hook’
# 168| hook_list_connect(VALUE list_owner, rb_hook_list_t *list, rb_event_hook_t *hook, int global_p)
# 169| {
# 170|-> rb_event_flag_t prev_events = list->events;
# 171| hook->next = list->hooks;
# 172| list->hooks = hook;
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/vm_trace.c: scope_hint: In function ‘remove_event_hook’
ruby-3.4.2/vm_trace.c:277:22: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
ruby-3.4.2/vm_trace.c: scope_hint: In function ‘remove_event_hook’
ruby-3.4.2/vm_trace.c: scope_hint: In function ‘remove_event_hook’
# 275| rb_hook_list_t *list = rb_ec_ractor_hooks(ec);
# 276| int ret = 0;
# 277|-> rb_event_hook_t *hook = list->hooks;
# 278|
# 279| while (hook) {
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/vm_trace.c: scope_hint: In function ‘tracepoint_stat_s’
ruby-3.4.2/vm_trace.c:1590:71: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
ruby-3.4.2/vm_trace.c: scope_hint: In function ‘tracepoint_stat_s’
# 1588| VALUE stat = rb_hash_new();
# 1589|
# 1590|-> tracepoint_stat_event_hooks(stat, vm->self, rb_ec_ractor_hooks(ec)->hooks);
# 1591| /* TODO: thread local hooks */
# 1592|
Error: CPPCHECK_WARNING (CWE-401):
ruby-3.4.2/vm_trace.c:1686: error[memleak]: Memory leak: wq_job
# 1684| RUBY_VM_SET_POSTPONED_JOB_INTERRUPT(rb_vm_main_ractor_ec(vm));
# 1685|
# 1686|-> return TRUE;
# 1687| }
# 1688|
Error: CPPCHECK_WARNING (CWE-457):
ruby-3.4.2/vsnprintf.c:642: warning[uninitvar]: Uninitialized variable: fp->_file
# 640| /* optimize fprintf(stderr) (and other unbuffered Unix files) */
# 641| if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) &&
# 642|-> fp->_file >= 0)
# 643| return (BSD__sbprintf(fp, fmt0, ap));
# 644|
Error: GCC_ANALYZER_WARNING (CWE-476):
ruby-3.4.2/yjit.c: scope_hint: In function ‘rb_c_method_tracing_currently_enabled’
ruby-3.4.2/yjit.c:364:24: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
ruby-3.4.2/yjit.c: scope_hint: In function ‘rb_c_method_tracing_currently_enabled’
ruby-3.4.2/internal/gc.h:17: included_from: Included from here.
ruby-3.4.2/shape.h:4: included_from: Included from here.
ruby-3.4.2/internal/variable.h:16: included_from: Included from here.
ruby-3.4.2/yjit.c:13: included_from: Included from here.
ruby-3.4.2/yjit.c: scope_hint: In function ‘rb_c_method_tracing_currently_enabled’
# 362| // ruby_vm_event_enabled_global_flags so always checking using it would
# 363| // mean we don't compile even after tracing is disabled.
# 364|-> tracing_events = rb_ec_ractor_hooks(ec)->events;
# 365| }
# 366|