anthy-unicode-1.0.0.20240502-1.fc41
List of Defects
Error: CPPCHECK_WARNING: [#def1]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/calctrans.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: GCC_ANALYZER_WARNING (CWE-476): [#def2]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/calctrans.c: scope_hint: In function ‘init_input_info’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/calctrans.c:95:13: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘m’
# 93| struct input_info *m;
# 94| m = malloc(sizeof(struct input_info));
# 95|-> m->seg_is = input_set_create();
# 96| m->cand_is = input_set_create();
# 97| m->indep_corpus = corpus_new();
Error: GCC_ANALYZER_WARNING (CWE-476): [#def3]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/calctrans.c: scope_hint: In function ‘dump_features’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/calctrans.c:337:14: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘lines’
# 335| for (il = input_set_get_input_line(is), i = 0; i < nr;
# 336| i++, il = il->next_line) {
# 337|-> lines[i] = il;
# 338| }
# 339| /* sort */
Error: GCC_ANALYZER_WARNING (CWE-688): [#def4]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/calctrans.c:340:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘lines’ where non-null expected
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/calctrans.c:38: included_from: Included from here.
/usr/include/stdlib.h:970:13: note: argument 1 of ‘qsort’ must be non-null
# 338| }
# 339| /* sort */
# 340|-> qsort(lines, nr, sizeof(struct input_line *), compare_line);
# 341| /* output */
# 342| fprintf(ofp, "%d %d total_line_weight,count\n", weight, nr);
Error: GCC_ANALYZER_WARNING (CWE-122): [#def5]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/calctrans.c: scope_hint: In function ‘string_pool_sort’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/calctrans.c:487:22: warning[-Wanalyzer-out-of-bounds]: heap-based buffer overflow
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/calctrans.c: scope_hint: In function ‘string_pool_sort’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/calctrans.c:487:22: note: write of 8 bytes to beyond the end of the region
# 485| struct string_node *node;
# 486| for (node = sp->hash[h].next_hash; node; node = node->next_hash) {
# 487|-> sp->array[idx] = node;
# 488| idx ++;
# 489| }
Error: GCC_ANALYZER_WARNING (CWE-476): [#def6]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/calctrans.c: scope_hint: In function ‘find_string_node’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/calctrans.c:530:13: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘node’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/calctrans.c:35: included_from: Included from here.
# 528| /* allocate new */
# 529| node = malloc(sizeof(*node));
# 530|-> node->str = strdup(str);
# 531| node->key = 0;
# 532| node->next_hash = sp->hash[h].next_hash;
Error: GCC_ANALYZER_WARNING (CWE-401): [#def7]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/calctrans.c: scope_hint: In function ‘flush_extract_stat.part.0’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/calctrans.c:559:9: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
# 557| xstr *xs = anthy_cstr_to_xstr(node->str, ANTHY_EUC_JP_ENCODING);
# 558| node->key = anthy_xstr_hash(xs);
# 559|-> anthy_free_xstr(xs);
# 560| }
# 561| /* printf("(%s)%d\n", es->info[i].indep, node->key); */
Error: GCC_ANALYZER_WARNING (CWE-476): [#def8]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/corpus.c: scope_hint: In function ‘corpus_setup_bucket’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/corpus.c:90:23: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*c.buckets’
# 88| c->buckets = malloc(sizeof(struct bucket) * nr);
# 89| for (i = 0; i < nr; i++) {
# 90|-> c->buckets[i].key = -1;
# 91| c->buckets[i].first_idx = -1;
# 92| c->buckets[i].last_idx = -1;
Error: CPPCHECK_WARNING: [#def9]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/input_set.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: GCC_ANALYZER_WARNING (CWE-457): [#def10]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/input_set.c: scope_hint: In function ‘find_same_line’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/input_set.c:60:11: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*is.buckets[<unknown>]’
# 58| struct input_line *il;
# 59| int h = line_hash(features, nr);
# 60|-> for (il = is->buckets[h]; il; il = il->next_in_hash) {
# 61| int i;
# 62| if (il->nr_features != nr) {
Error: GCC_ANALYZER_WARNING (CWE-476): [#def11]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/input_set.c: scope_hint: In function ‘int_map_flatten’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/input_set.c:313:18: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*im.array’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/input_set.c:10: included_from: Included from here.
# 311| im->array_size);
# 312| for (i = 0; i < im->array_size; i++) {
# 313|-> im->array[i] = NULL;
# 314| }
# 315| /* 要素を置いていく */
Error: GCC_ANALYZER_WARNING (CWE-476): [#def12]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/proccorpus.c: scope_hint: In function ‘find_candidate’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/proccorpus.c:67:25: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*cr.cand_check’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/proccorpus.c: scope_hint: In function ‘find_candidate’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/proccorpus.c: scope_hint: In function ‘find_candidate’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/proccorpus.c: scope_hint: In function ‘find_candidate’
# 65| /* 候補ミスのマーク「~」をスキップする */
# 66| seg++;
# 67|-> cr->cand_check[nth] = 1;
# 68| }
# 69|
Error: GCC_ANALYZER_WARNING (CWE-476): [#def13]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/proccorpus.c: scope_hint: In function ‘proc_sentence’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/proccorpus.c:134:23: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*cr.cand_check’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/proccorpus.c: scope_hint: In function ‘proc_sentence’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/calctrans/proccorpus.c: scope_hint: In function ‘proc_sentence’
# 132| cr->cand_check = malloc(sizeof(int) * acs.nr_segment);
# 133| for (i = 0; i < acs.nr_segment; i++) {
# 134|-> cr->cand_check[i] = 0;
# 135| }
# 136|
Error: CPPCHECK_WARNING: [#def14]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/depgraph/mkdepgraph.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: GCC_ANALYZER_WARNING (CWE-415): [#def15]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/depgraph/mkdepgraph.c: scope_hint: In function ‘get_node_id_by_name’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/depgraph/mkdepgraph.c:79:16: warning[-Wanalyzer-double-free]: double-‘free’ of ‘0’
# 77| }
# 78| gNodes = tmp;
# 79|-> if (!(tmp2 = realloc(gNodeNames, sizeof(char*)*(nrNodes+1)))) {
# 80| anthy_log(0, "Could not realloc gNodeNames.\n");
# 81| free(gNodes);
Error: GCC_ANALYZER_WARNING (CWE-688): [#def16]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/depgraph/mkdepgraph.c: scope_hint: In function ‘parse_dep’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/depgraph/mkdepgraph.c:230:7: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘s’ where non-null expected
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/depgraph/mkdepgraph.c:27: included_from: Included from here.
<built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null
# 228| char *s;
# 229| s = strdup(&tokens[row][1]);
# 230|-> s[strlen(s)-1] =0;
# 231| strs[nr_strs] = anthy_cstr_to_xstr(s, ANTHY_UTF8_ENCODING);
# 232| nr_strs ++;
Error: GCC_ANALYZER_WARNING (CWE-775): [#def17]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/depgraph/mkdepgraph.c: scope_hint: In function ‘write_file’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/depgraph/mkdepgraph.c:461:3: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(file_name, "w")’
# 459| }
# 460| /* 各ルール */
# 461|-> write_nl(fp, nrRules);
# 462| for (i = 0; i < nrRules; ++i) {
# 463| write_wtype(fp, gRules[i].wt);
Error: GCC_ANALYZER_WARNING (CWE-401): [#def18]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/depgraph/mkdepgraph.c:461:3: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(file_name, "w")’
# 459| }
# 460| /* 各ルール */
# 461|-> write_nl(fp, nrRules);
# 462| for (i = 0; i < nrRules; ++i) {
# 463| write_wtype(fp, gRules[i].wt);
Error: GCC_ANALYZER_WARNING (CWE-775): [#def19]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/mkanthydic/mkfiledic.c: scope_hint: In function ‘create_file_dic’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/mkanthydic/mkfiledic.c:95:46: warning[-Wanalyzer-file-leak]: leak of FILE ‘fopen(fn, "w")’
# 93| int contents_offset;
# 94|
# 95|-> name_offset = sizeof(int) * (1 + entry_num * 3);
# 96| contents_offset = name_offset;
# 97|
Error: GCC_ANALYZER_WARNING (CWE-401): [#def20]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/mkanthydic/mkfiledic.c:95:46: warning[-Wanalyzer-malloc-leak]: leak of ‘fopen(fn, "w")’
# 93| int contents_offset;
# 94|
# 95|-> name_offset = sizeof(int) * (1 + entry_num * 3);
# 96| contents_offset = name_offset;
# 97|
Error: CPPCHECK_WARNING: [#def21]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/mkworddic/mkdic.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: GCC_ANALYZER_WARNING (CWE-401): [#def22]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/mkworddic/mkdic.c: scope_hint: In function ‘open_output_files’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/mkworddic/mkdic.c:126:14: warning[-Wanalyzer-malloc-leak]: leak of ‘strdup(&buf)’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/mkworddic/mkdic.c:38: included_from: Included from here.
# 124| } else {
# 125| *(fs->fpp) = fdopen(fd, "w+");
# 126|-> fs->fn = strdup(buf);
# 127| }
# 128| /**/
Error: GCC_ANALYZER_WARNING (CWE-401): [#def23]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/mkworddic/mkdic.c:126:16: warning[-Wanalyzer-malloc-leak]: leak of ‘fdopen(mkstemp(&buf), "w+")’
# 124| } else {
# 125| *(fs->fpp) = fdopen(fd, "w+");
# 126|-> fs->fn = strdup(buf);
# 127| }
# 128| /**/
Error: COMPILER_WARNING: [#def24]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/mkworddic/mkdic.c: scope_hint: In function ‘main’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/mkworddic/mkdic.c:130:25: warning[-Wformat-overflow=]: ‘%s’ directive argument is null
# 130 | fprintf (stderr, "%s: cannot open temporary file: %s\n",
# | ^~
# 128| /**/
# 129| if (!(*(fs->fpp))) {
# 130|-> fprintf (stderr, "%s: cannot open temporary file: %s\n",
# 131| progname, strerror (errno));
# 132| exit (2);
Error: COMPILER_WARNING: [#def25]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/mkworddic/mkdic.c:145:25: warning[-Wformat-overflow=]: ‘%s’ directive argument is null
# 145 | fprintf (stderr, "%s: write error\n", progname);
# | ^~
# 143| for (fs = file_array; fs->fpp; fs ++) {
# 144| if (ferror(*(fs->fpp))) {
# 145|-> fprintf (stderr, "%s: write error\n", progname);
# 146| exit (1);
# 147| }
Error: COMPILER_WARNING: [#def26]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/mkworddic/mkdic.c:151:25: warning[-Wformat-overflow=]: ‘%s’ directive argument is null
# 151 | fprintf (stderr, "%s: write error: %s\n", progname, strerror (errno));
# | ^~
# 149| for (fs = file_array; fs->fpp; fs ++) {
# 150| if (fflush(*(fs->fpp))) {
# 151|-> fprintf (stderr, "%s: write error: %s\n", progname, strerror (errno));
# 152| exit (1);
# 153| }
Error: GCC_ANALYZER_WARNING (CWE-688): [#def27]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/mkworddic/mkdic.c: scope_hint: In function ‘push_back_word_entry_line’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/mkworddic/mkdic.c:378:15: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘ent’ where non-null expected
<built-in>: note: argument 1 of ‘__builtin_strlen’ must be non-null
# 376| const char *ent)
# 377| {
# 378|-> char *buf = alloca(strlen(ent) + 1);
# 379| char *cur = buf;
# 380| char *n;
Error: GCC_ANALYZER_WARNING (CWE-476): [#def28]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/mkworddic/mkdic.c: scope_hint: In function ‘find_yomi_entry’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/mkworddic/mkdic.c:528:18: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘ye’
# 526| /* 無いので確保 */
# 527| ye = malloc(sizeof(struct yomi_entry));
# 528|-> ye->nr_entries = 0;
# 529| ye->entries = 0;
# 530| ye->next = NULL;
Error: COMPILER_WARNING: [#def29]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/mkworddic/mkdic.c:796:25: warning[-Wformat-overflow=]: ‘%s’ directive argument is null
# 796 | fprintf (stderr, "%s: %s: write error: %s\n",
# | ^~
# 794| if (fwrite (buf, 1, nread, out) < nread) {
# 795| /* Handle short write (maybe disk full). */
# 796|-> fprintf (stderr, "%s: %s: write error: %s\n",
# 797| progname, mds->output_fn, strerror (errno));
# 798| exit (1);
Error: COMPILER_WARNING: [#def30]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/mkworddic/mkdic.c:842:25: warning[-Wformat-overflow=]: ‘%s’ directive argument is null
# 842 | fprintf (stderr, "%s: %s: cannot create: %s\n",
# | ^~
# 840| fp = fopen (mds->output_fn, "w");
# 841| if (!fp) {
# 842|-> fprintf (stderr, "%s: %s: cannot create: %s\n",
# 843| progname, mds->output_fn, strerror (errno));
# 844| exit (1);
Error: COMPILER_WARNING: [#def31]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/mkworddic/mkdic.c:859:23: warning[-Wformat-overflow=]: ‘%s’ directive argument is null
# 859 | fprintf (stderr, "%s: %s: write error: %s\n",
# | ^~
# 857|
# 858| if (fclose (fp)) {
# 859|-> fprintf (stderr, "%s: %s: write error: %s\n",
# 860| progname, mds->output_fn, strerror (errno));
# 861| exit (1);
Error: CPPCHECK_WARNING: [#def32]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/mkworddic/mkudic.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CPPCHECK_WARNING: [#def33]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/mkworddic/writewords.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: GCC_ANALYZER_WARNING (CWE-476): [#def34]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/mkworddic/writewords.c: scope_hint: In function ‘compare_word_entry’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/mkworddic/writewords.c:66:7: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘prev_we’
# 64| struct word_entry *we)
# 65| {
# 66|-> if (strcmp(prev_we->wt_name, we->wt_name) ||
# 67| (prev_we->freq / 100) != (we->freq / 100) ||
# 68| prev_we->feature != we->feature) {
Error: GCC_ANALYZER_WARNING (CWE-401): [#def35]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/conf.c: scope_hint: In function 'ensure_buffer'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/conf.c:126:13: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
# 124| eb->size += required;
# 125| eb->buf = realloc(eb->buf, eb->size);
# 126|-> eb->cur = &eb->buf[eb->len];
# 127| }
# 128| }
Error: GCC_ANALYZER_WARNING (CWE-476): [#def36]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/conf.c: scope_hint: In function 'add_val'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/conf.c:177:8: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
# 175| struct val_ent *e;
# 176| e = find_val_ent(var);
# 177|-> if (e->val) {
# 178| free((void *)e->val);
# 179| }
Error: GCC_ANALYZER_WARNING (CWE-476): [#def37]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/conf.c: scope_hint: In function 'anthy_conf_get_str'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/conf.c:279:9: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
# 277| struct val_ent *e;
# 278| e = find_val_ent(var);
# 279|-> if (!e->val && var)
# 280| return getenv (var);
# 281| return e->val;
Error: CPPCHECK_WARNING: [#def38]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/file_dic.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: GCC_ANALYZER_WARNING (CWE-476): [#def39]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/file_dic.c: scope_hint: In function 'anthy_mkdir_with_parents'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/file_dic.c:200:12: warning[-Wanalyzer-null-dereference]: dereference of NULL 'p'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/file_dic.c:18: included_from: Included from here.
# 198|
# 199| do {
# 200|-> while (*p && !ANTHY_IS_DIR_SEPARATOR (*p))
# 201| p++;
# 202|
Error: CPPCHECK_WARNING: [#def40]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/filemap.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CPPCHECK_WARNING: [#def41]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/ruleparser.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CPPCHECK_WARNING: [#def42]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/xchar.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CPPCHECK_WARNING: [#def43]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/xstr.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: GCC_ANALYZER_WARNING (CWE-476): [#def44]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/xstr.c: scope_hint: In function 'anthy_cstr_to_xstr'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/xstr.c:192:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'malloc((long unsigned int)xlengthofcstr(c) * 4)'
# 190| for (i = 0, j = 0; i < l; i++) {
# 191| if (!(c[j] & 0x80)){
# 192|-> x->str[i] = c[j];
# 193| j++;
# 194| } else {
Error: GCC_ANALYZER_WARNING (CWE-476): [#def45]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/xstr.c:196:17: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'malloc((long unsigned int)xlengthofcstr(c) * 4)'
# 194| } else {
# 195| unsigned char *p = (unsigned char *)&c[j];
# 196|-> x->str[i] = (p[1] | (p[0]<<8)) | 0x8080;
# 197| x->str[i] = anthy_euc_to_ucs(x->str[i]);
# 198| j++;
Error: GCC_ANALYZER_WARNING (CWE-476): [#def46]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/xstr.c: scope_hint: In function 'anthy_xstr_to_cstr'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/xstr.c:217:14: warning[-Wanalyzer-null-dereference]: dereference of NULL '*s.str + (long unsigned int)i * 4'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/xstr.c:31: included_from: Included from here.
# 215| l = s->len;
# 216| for (i = 0; i < s->len; i++) {
# 217|-> int ec = anthy_ucs_to_euc(s->str[i]);
# 218| if (ec > 255) {
# 219| l++;
Error: GCC_ANALYZER_WARNING (CWE-401): [#def47]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/xstr.c: scope_hint: In function 'anthy_xstr_wide_num_to_num'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/xstr.c:248:13: warning[-Wanalyzer-malloc-leak]: leak of 'anthy_xstr_dup(src_xs)'
# 246| if (!x)
# 247| return NULL;
# 248|-> x->len = s->len;
# 249| if (s->len) {
# 250| assert(s->str);
Error: GCC_ANALYZER_WARNING (CWE-401): [#def48]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/xstr.c: scope_hint: In function 'anthy_conv_half_wide'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/xstr.c:248:13: warning[-Wanalyzer-malloc-leak]: leak of 'anthy_xstr_dup(xs)'
# 246| if (!x)
# 247| return NULL;
# 248|-> x->len = s->len;
# 249| if (s->len) {
# 250| assert(s->str);
Error: GCC_ANALYZER_WARNING (CWE-476): [#def49]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/xstr.c: scope_hint: In function 'anthy_xstr_hira_to_half_kata'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/xstr.c:612:18: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'malloc((long unsigned int)len * 4)'
# 610| const struct half_kana_table *tab = anthy_find_half_kana(src_xs->str[i]);
# 611| if (tab) {
# 612|-> xs->str[j] = anthy_euc_to_ucs(tab->dst);
# 613| if (tab->mod) {
# 614| j++;
Error: GCC_ANALYZER_WARNING (CWE-476): [#def50]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-diclib/xstr.c:618:18: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'malloc((long unsigned int)len * 4)'
# 616| }
# 617| } else {
# 618|-> xs->str[j] = src_xs->str[i];
# 619| }
# 620| j++;
Error: CPPCHECK_WARNING: [#def51]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-main/context.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: GCC_ANALYZER_WARNING (CWE-476): [#def52]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-main/context.c: scope_hint: In function 'make_metaword_array'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-main/context.c:177:23: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL '*se.mw_array + (long unsigned int)j * 8'
# 175| se->mw_array = malloc(sizeof(struct meta_word*) * se->nr_metaword);
# 176| for (j = 0; j < se->nr_metaword; j++) {
# 177|-> se->mw_array[j] = anthy_get_nth_metaword(&ac->split_info, se->from, i, j);
# 178| }
# 179| return;
Error: COMPILER_WARNING (CWE-697): [#def53]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-main/context.c: scope_hint: In function 'anthy_release_cand_ent'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-main/context.c:712:7: warning[-Waddress]: the comparison will always evaluate as 'true' for the address of 'str' will never be NULL
# 712 | if (&ce->str) {
# | ^
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-main/main.h:7: included_from: Included from here.
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-main/context.c:48: included_from: Included from here.
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/anthy/segment.h:27:8: note: 'str' declared here
# 27 | xstr str;
# | ^~~
# 710| free(ce->elm);
# 711| }
# 712|-> if (&ce->str) {
# 713| anthy_free_xstr_str(&ce->str);
# 714| }
Error: CPPCHECK_WARNING: [#def54]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-main/main.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CPPCHECK_WARNING: [#def55]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-ordering/candhistory.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CPPCHECK_WARNING: [#def56]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-ordering/candswap.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CPPCHECK_WARNING: [#def57]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-ordering/commit.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: GCC_ANALYZER_WARNING (CWE-401): [#def58]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/compose.c: scope_hint: In function 'enum_candidates'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/compose.c:73:24: warning[-Wanalyzer-malloc-leak]: leak of 'dup_candidate(ce)'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/compose.c:35: included_from: Included from here.
# 71| if (!(ce_new = alloc_cand_ent()))
# 72| return NULL;
# 73|-> ce_new->nr_words = ce->nr_words;
# 74| ce_new->str.len = ce->str.len;
# 75| ce_new->str.str = anthy_xstr_dup_str(&ce->str);
Error: GCC_ANALYZER_WARNING (CWE-401): [#def59]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/compose.c: scope_hint: In function 'push_back_candidate'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/compose.c:104:18: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
# 102| anthy_log(0, "Failed realloc in %s:%d\n", __FILE__, __LINE__);
# 103| seg->cands = cands;
# 104|-> seg->nr_cands--;
# 105| return;
# 106| }
Error: CLANG_WARNING: [#def60]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/compose.c:138:1: warning[unix.Malloc]: Potential leak of memory pointed to by 'ce'
# 136| anthy_free_xstr(xs);
# 137| push_back_candidate(seg, ce);
# 138|-> }
# 139|
# 140| /** 再帰で1単語ずつ候補を割当てていく */
Error: CLANG_WARNING: [#def61]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/compose.c:262:1: warning[unix.Malloc]: Potential leak of memory pointed to by 'ce'
# 260| }
# 261| }
# 262|-> }
# 263|
# 264| static void
Error: CLANG_WARNING: [#def62]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/compose.c:280:8: warning[unix.Malloc]: Potential leak of memory pointed to by 'ce'
# 278| /* 次にカタカナ */
# 279| ce = alloc_cand_ent();
# 280|-> xs = anthy_xstr_hira_to_kata(&seg->str);
# 281| ce->str.str = anthy_xstr_dup_str(xs);
# 282| ce->str.len = xs->len;
Error: CLANG_WARNING: [#def63]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/compose.c:297:1: warning[unix.Malloc]: Potential leak of memory pointed to by 'ce'
# 295| push_back_candidate(seg, ce);
# 296| }
# 297|-> }
# 298|
# 299| /* word_listの要素part_infoの配列からcand_elmの配列を作る */
Error: GCC_ANALYZER_WARNING (CWE-476): [#def64]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/compose.c: scope_hint: In function 'make_candidate_from_simple_metaword'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/compose.c:351:16: warning[-Wanalyzer-null-dereference]: dereference of NULL 'alloc_cand_ent()'
# 349| /* 複数(1も含む)の単語で構成される文節に単語を割当てていく */
# 350| ce = alloc_cand_ent();
# 351|-> ce->nr_words = mw->nr_parts;
# 352| ce->str.str = NULL;
# 353| ce->str.len = 0;
Error: COMPILER_WARNING: [#def65]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/compose.c: scope_hint: In function 'make_candidate_from_simple_metaword'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/compose.c:354:33: warning[-Wcalloc-transposed-args]: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument
# 354 | if (!(ce->elm = calloc(sizeof(struct cand_elm),ce->nr_words))) {
# | ^~~~~~
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/compose.c:354:33: note: earlier argument should specify number of elements, later size of each element
# 352| ce->str.str = NULL;
# 353| ce->str.len = 0;
# 354|-> if (!(ce->elm = calloc(sizeof(struct cand_elm),ce->nr_words))) {
# 355| anthy_log(0, "Failed calloc in %s:%d\n", __FILE__, __LINE__);
# 356| ce->nr_words = 0;
Error: COMPILER_WARNING: [#def66]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/compose.c: scope_hint: In function 'make_candidate_from_combined_metaword'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/compose.c:396:33: warning[-Wcalloc-transposed-args]: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument
# 396 | if (!(ce->elm = calloc(sizeof(struct cand_elm),ce->nr_words))) {
# | ^~~~~~
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/compose.c:396:33: note: earlier argument should specify number of elements, later size of each element
# 394| ce->str.str = NULL;
# 395| ce->str.len = 0;
# 396|-> if (!(ce->elm = calloc(sizeof(struct cand_elm),ce->nr_words))) {
# 397| anthy_log(0, "Failed malloc in %s:%d\n", __FILE__, __LINE__);
# 398| free(ce);
Error: CLANG_WARNING: [#def67]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/compose.c:495:1: warning[unix.Malloc]: Potential leak of memory pointed to by 'ce'
# 493| break;
# 494| }
# 495|-> }
# 496|
# 497| /** context.cから呼出されるもっとも大物
Error: CPPCHECK_WARNING: [#def68]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/depgraph.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CPPCHECK_WARNING: [#def69]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/lattice.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: GCC_ANALYZER_WARNING (CWE-476): [#def70]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/lattice.c: scope_hint: In function 'alloc_lattice_info'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/lattice.c:228:12: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'info'
# 226| int i;
# 227| struct lattice_info* info = (struct lattice_info*)malloc(sizeof(struct lattice_info));
# 228|-> info->sc = sc;
# 229| info->lattice_node_list = (struct node_list_head*)
# 230| malloc((size + 1) * sizeof(struct node_list_head));
Error: CLANG_WARNING: [#def71]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/lattice.c:391:8: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined
# 389| }
# 390| /* 先頭のnodeが無ければ無条件に追加 */
# 391|-> node = info->lattice_node_list[position].head;
# 392| if (!node) {
# 393| info->lattice_node_list[position].head = new_node;
Error: CLANG_WARNING: [#def72]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/lattice.c:476:10: warning[core.uninitialized.Branch]: Branch condition evaluates to a garbage value
# 474| return;
# 475| }
# 476|-> while (!info->lattice_node_list[last].head) {
# 477| /* 最後の文字まで遷移していなかったら後戻り */
# 478| --last;
Error: CLANG_WARNING: [#def73]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/lattice.c:529:20: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined
# 527| /* 全ての遷移を左から試す */
# 528| for (i = from; i < to; ++i) {
# 529|-> for (left_node = info->lattice_node_list[i].head; left_node;
# 530| left_node = left_node->next) {
# 531| struct meta_word *mw;
Error: CLANG_WARNING: [#def74]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/lattice.c:555:13: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined
# 553|
# 554| /* 文末補正 */
# 555|-> for (node = info->lattice_node_list[to].head; node; node = node->next) {
# 556| struct feature_list features;
# 557| anthy_feature_list_init(&features);
Error: CPPCHECK_WARNING: [#def75]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/metaword.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CPPCHECK_WARNING: [#def76]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/splitter.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: GCC_ANALYZER_WARNING (CWE-476): [#def77]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/splitter.c: scope_hint: In function 'alloc_info_cache'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/splitter.c:135:22: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'malloc((long unsigned int)(*sc.char_count + 1) * 4)'
# 133| /* 各文字インデックスに対して初期化を行う */
# 134| for (i = 0; i <= sc->char_count; i++) {
# 135|-> info->seq_len[i] = 0;
# 136| info->rev_seq_len[i] = 0;
# 137| info->cnode[i].wl = NULL;
Error: GCC_ANALYZER_WARNING (CWE-476): [#def78]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/splitter.c:136:26: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'malloc((long unsigned int)(*sc.char_count + 1) * 4)'
# 134| for (i = 0; i <= sc->char_count; i++) {
# 135| info->seq_len[i] = 0;
# 136|-> info->rev_seq_len[i] = 0;
# 137| info->cnode[i].wl = NULL;
# 138| info->cnode[i].mw = NULL;
Error: GCC_ANALYZER_WARNING (CWE-476): [#def79]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/splitter.c:137:23: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'malloc((long unsigned int)(*sc.char_count + 1) * 24)'
# 135| info->seq_len[i] = 0;
# 136| info->rev_seq_len[i] = 0;
# 137|-> info->cnode[i].wl = NULL;
# 138| info->cnode[i].mw = NULL;
# 139| info->cnode[i].max_len = 0;
Error: CPPCHECK_WARNING: [#def80]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-splitter/wordlist.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CPPCHECK_WARNING: [#def81]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: GCC_ANALYZER_WARNING (CWE-476): [#def82]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c: scope_hint: In function ‘encode_command_arg’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c:164:12: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘s’
/usr/include/sys/select.h:30: included_from: Included from here.
/usr/include/sys/time.h:32: included_from: Included from here.
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c:16: included_from: Included from here.
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c:68:20: note: in definition of macro ‘MAX’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c:23: included_from: Included from here.
# 162| for(i = 0,j = 0; i < len; i++) {
# 163| if (a[i] != '\\') {
# 164|-> s[j] = a[i];
# 165| j++;
# 166| continue;
Error: GCC_ANALYZER_WARNING (CWE-476): [#def83]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c:173:12: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘s’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c:68:20: note: in definition of macro ‘MAX’
# 171| case 0:
# 172| case '\\':
# 173|-> s[j] = '\\';
# 174| j++;
# 175| break;
Error: GCC_ANALYZER_WARNING (CWE-476): [#def84]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c:177:12: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘s’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c:68:20: note: in definition of macro ‘MAX’
# 175| break;
# 176| case '\"':
# 177|-> s[j] = '\"';
# 178| j++;
# 179| break;
Error: GCC_ANALYZER_WARNING (CWE-688): [#def85]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c:192:14: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘s’ where non-null expected
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c:68:20: note: in definition of macro ‘MAX’
<built-in>: note: argument 1 of ‘__builtin_sprintf’ must be non-null
# 190| p[0] = num & 255;
# 191| p[1] = num >> 8;
# 192|-> j += sprintf(&s[j], "%c%c", buf[1] , buf[0]);
# 193| }
# 194| break;
Error: GCC_ANALYZER_WARNING (CWE-476): [#def86]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c:197:8: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘s’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c:68:20: note: in definition of macro ‘MAX’
# 195| }
# 196| }
# 197|-> s[j] = 0;
# 198|
# 199| return s;
Error: GCC_ANALYZER_WARNING (CWE-476): [#def87]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c: scope_hint: In function ‘make_command0’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c:228:12: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘cmd’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c:68:20: note: in definition of macro ‘MAX’
# 226|
# 227| cmd = (struct command*) malloc(sizeof(struct command));
# 228|-> cmd->cmd = no;
# 229| cmd->n_arg = 0;
# 230| cmd->arg = NULL;
Error: GCC_ANALYZER_WARNING (CWE-476): [#def88]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c: scope_hint: In function ‘make_command1’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c:242:12: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘cmd’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c:68:20: note: in definition of macro ‘MAX’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c:22: included_from: Included from here.
# 240|
# 241| cmd = (struct command*) malloc(sizeof(struct command));
# 242|-> cmd->cmd = no;
# 243| cmd->n_arg = 1;
# 244| cmd->arg = (char**) malloc(sizeof(char*) * 1);
Error: GCC_ANALYZER_WARNING (CWE-476): [#def89]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c:245:15: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘malloc(8)’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c:68:20: note: in definition of macro ‘MAX’
# 243| cmd->n_arg = 1;
# 244| cmd->arg = (char**) malloc(sizeof(char*) * 1);
# 245|-> cmd->arg[0] = strdup(arg1);
# 246| cmd->next = NULL;
# 247|
Error: GCC_ANALYZER_WARNING (CWE-476): [#def90]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c: scope_hint: In function ‘make_hl_command’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c:360:12: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘cmd’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c:68:20: note: in definition of macro ‘MAX’
# 358| /* コマンドを作る */
# 359| cmd = (struct command*) malloc(sizeof(struct command));
# 360|-> cmd->cmd = cmdn->cmd;
# 361| cmd->n_arg = cmdn->n_arg;
# 362| if (cmd->n_arg > 0) {
Error: CPPCHECK_WARNING (CWE-457): [#def91]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/agent.c:637: error[uninitvar]: Uninitialized variable: buf
# 635| if (q >= end) {
# 636| *q = '\0';
# 637|-> write_reply(buf);
# 638| q = buf;
# 639| }
Error: CPPCHECK_WARNING: [#def92]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/convdb.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CPPCHECK_WARNING: [#def93]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/dic-tool.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: GCC_ANALYZER_WARNING (CWE-401): [#def94]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/dic-tool.c: scope_hint: In function ‘open_typetab’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/dic-tool.c:136:5: warning[-Wanalyzer-malloc-leak]: leak of ‘fn’
# 134| }
# 135| if (!(tmp = realloc(fn, strlen(fn) + strlen(TYPETAB) + 4))) {
# 136|-> anthy_log(0, "Could not realloc TYPETAB.\n");
# 137| /* free(fn) is freed twice. */
# 138| return NULL;
Error: CPPCHECK_WARNING (CWE-415): [#def95]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/dic-tool.c:170: error[doubleFree]: Memory pointed to by 'fn' is freed twice.
# 168| * CLANG_WARNING reports: 'fn' is freed twice.
# 169| */
# 170|-> free(fn);
# 171| return NULL;
# 172| }
Error: GCC_ANALYZER_WARNING (CWE-476): [#def96]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/dic-tool.c: scope_hint: In function ‘read_typetab_entry’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/dic-tool.c:345:16: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘t’
# 343| t = malloc(sizeof(struct trans_tab));
# 344| sprintf(type_name, "#%s", buf);
# 345|-> t->type_name = strdup(type_name);
# 346| t->var_list.next = 0;
# 347| /* パラメータを読む */
Error: COMPILER_WARNING: [#def97]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/dic-tool.c: scope_hint: In function ‘load_text_dic’
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/dic-tool.c:555:45: warning[-Wcalloc-transposed-args]: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument
# 555 | if (!(d = dict_head = calloc (sizeof (struct dict_entry), 1))) {
# | ^~~~~~
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/dic-tool.c:555:45: note: earlier argument should specify number of elements, later size of each element
# 553| }
# 554| if (!dict_head) {
# 555|-> if (!(d = dict_head = calloc (sizeof (struct dict_entry), 1))) {
# 556| anthy_log(0, "Failed calloc in %s:%d\n", __FILE__, __LINE__);
# 557| free(yomi);
Error: COMPILER_WARNING: [#def98]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/dic-tool.c:561:39: warning[-Wcalloc-transposed-args]: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument
# 561 | if (!(d->next = calloc (sizeof (struct dict_entry), 1))) {
# | ^~~~~~
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/dic-tool.c:561:39: note: earlier argument should specify number of elements, later size of each element
# 559| }
# 560| } else {
# 561|-> if (!(d->next = calloc (sizeof (struct dict_entry), 1))) {
# 562| anthy_log(0, "Failed calloc in %s:%d\n", __FILE__, __LINE__);
# 563| free(yomi);
Error: CPPCHECK_WARNING: [#def99]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/egg.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CPPCHECK_WARNING: [#def100]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/input.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: GCC_ANALYZER_WARNING (CWE-401): [#def101]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/input.c: scope_hint: In function 'ensure_buffer'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/input.c:114:10: warning[-Wanalyzer-malloc-leak]: leak of '*ictx.hbuf'
# 112| {
# 113| if (*size < to_size) {
# 114|-> *buf = (char*) realloc(*buf, to_size);
# 115| if (*buf == NULL) {
# 116| anthy_input_errno = AIE_NOMEM;
Error: GCC_ANALYZER_WARNING (CWE-476): [#def102]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/input.c: scope_hint: In function 'enter_conv_state'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/input.c:270:15: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'as'
# 268| struct a_segment* as;
# 269| as = (struct a_segment*) malloc(sizeof(struct a_segment));
# 270|-> as->index = i;
# 271| as->pos = last_pos;
# 272| anthy_get_segment_stat(ictx->actx, i, &as->ass);
Error: GCC_ANALYZER_WARNING (CWE-465): [#def103]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/input.c: scope_hint: In function 'cmd_next_candidate'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/input.c:662:12: warning[-Wanalyzer-deref-before-check]: check of 'as' for NULL after already dereferencing it
# 660|
# 661| if (as->cand == NTH_UNCONVERTED_CANDIDATE) {
# 662|-> while (as) {
# 663| if (as->cand == NTH_UNCONVERTED_CANDIDATE) {
# 664| as->cand = 0;
Error: CPPCHECK_WARNING: [#def104]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/rkconv.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CPPCHECK_WARNING: [#def105]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-util/rkhelper.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CPPCHECK_WARNING: [#def106]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/dic_util.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CPPCHECK_WARNING: [#def107]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/ext_ent.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: GCC_ANALYZER_WARNING (CWE-401): [#def108]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/ext_ent.c: scope_hint: In function 'pushback_place_name.part.0'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/ext_ent.c:63:12: warning[-Wanalyzer-malloc-leak]: leak of 'zl.strs'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/ext_ent.c: scope_hint: In function 'pushback_place_name.part.0'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/ext_ent.c: scope_hint: In function 'pushback_place_name.part.0'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/ext_ent.c: scope_hint: In function 'pushback_place_name.part.0'
# 61| return ;
# 62| }
# 63|-> zl->strs = realloc(zl->strs, sizeof(xstr *) * (zl->nr + 1));
# 64| zl->strs[zl->nr] = anthy_cstr_to_xstr(pn, ANTHY_EUC_JP_ENCODING);
# 65| zl->nr++;
Error: GCC_ANALYZER_WARNING (CWE-476): [#def109]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/ext_ent.c:64:20: warning[-Wanalyzer-null-dereference]: dereference of NULL '0'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/ext_ent.c: scope_hint: In function 'pushback_place_name.part.0'
# 62| }
# 63| zl->strs = realloc(zl->strs, sizeof(xstr *) * (zl->nr + 1));
# 64|-> zl->strs[zl->nr] = anthy_cstr_to_xstr(pn, ANTHY_EUC_JP_ENCODING);
# 65| zl->nr++;
# 66| }
Error: CPPCHECK_WARNING: [#def110]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/feature_set.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CPPCHECK_WARNING: [#def111]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/matrix.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CLANG_WARNING: [#def112]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/matrix.c:205:29: warning[core.UndefinedBinaryOperatorResult]: The left operand of '==' is a garbage value
# 203| int h = hash(e->index, s->array_len, n);
# 204| assert((h >= 0) && (h < s->array_len));
# 205|-> if (s->array[h].index == -1) {
# 206| /* find unused element in this array */
# 207| ok = 1;
Error: CLANG_WARNING: [#def113]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/matrix.c:383:7: warning[unix.Malloc]: Potential leak of memory pointed to by 'a'
# 381| for (e = &a->head; e; e = e->next) {
# 382| if (e->index == column) {
# 383|-> return e->value;
# 384| }
# 385| }
Error: CPPCHECK_WARNING: [#def114]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/priv_dic.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: GCC_ANALYZER_WARNING (CWE-688): [#def115]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/priv_dic.c: scope_hint: In function 'init_lock_fn'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/priv_dic.c:136:20: warning[-Wanalyzer-null-argument]: use of NULL 'home' where non-null expected
<built-in>: note: argument 1 of '__builtin_strlen' must be non-null
# 134| init_lock_fn(const char *home, const char *id)
# 135| {
# 136|-> lock_fn = malloc(strlen(home) + strlen(id) + 33);
# 137| sprintf(lock_fn, "%s/lock-file_%s", home, id);
# 138| }
Error: GCC_ANALYZER_WARNING (CWE-688): [#def116]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/priv_dic.c:137:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'lock_fn' where non-null expected
<built-in>: note: argument 1 of '__builtin_sprintf' must be non-null
# 135| {
# 136| lock_fn = malloc(strlen(home) + strlen(id) + 33);
# 137|-> sprintf(lock_fn, "%s/lock-file_%s", home, id);
# 138| }
# 139|
Error: GCC_ANALYZER_WARNING (CWE-688): [#def117]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/priv_dic.c: scope_hint: In function 'open_tt_dic'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/priv_dic.c:144:22: warning[-Wanalyzer-null-argument]: use of NULL 'home' where non-null expected
<built-in>: note: argument 1 of '__builtin_strlen' must be non-null
# 142| {
# 143| struct text_trie *tt;
# 144|-> char *buf = malloc(strlen(home) + strlen(id) + 33);
# 145| sprintf(buf, "%s/private_dict_%s.tt", home, id);
# 146| tt = anthy_trie_open(buf, 0);
Error: GCC_ANALYZER_WARNING (CWE-688): [#def118]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/priv_dic.c:145:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'buf' where non-null expected
<built-in>: note: argument 1 of '__builtin_sprintf' must be non-null
# 143| struct text_trie *tt;
# 144| char *buf = malloc(strlen(home) + strlen(id) + 33);
# 145|-> sprintf(buf, "%s/private_dict_%s.tt", home, id);
# 146| tt = anthy_trie_open(buf, 0);
# 147| free(buf);
Error: GCC_ANALYZER_WARNING (CWE-688): [#def119]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/priv_dic.c: scope_hint: In function 'open_textdic'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/priv_dic.c:156:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'fn' where non-null expected
<built-in>: note: argument 1 of '__builtin_sprintf' must be non-null
# 154| char *fn = malloc(strlen(home) + strlen(name) + strlen(id) + 2);
# 155| struct textdict *td;
# 156|-> sprintf(fn, "%s/%s%s", home, name, id);
# 157| td = anthy_textdict_open(fn);
# 158| free(fn);
Error: GCC_ANALYZER_WARNING (CWE-688): [#def120]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/priv_dic.c: scope_hint: In function 'anthy_init_private_dic_option'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/priv_dic.c:498:3: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'imported_dic_dir' where non-null expected
<built-in>: note: argument 1 of '__builtin_sprintf' must be non-null
# 496| imported_text_dic = open_textdic(home, "imported_words_", id);
# 497| imported_dic_dir = malloc(strlen(home) + strlen(id) + 23);
# 498|-> sprintf(imported_dic_dir, "%s/imported_words_%s.d/", home, id);
# 499| if (is_old) {
# 500| old_anthy_private_tt_dic = tt_dic;
Error: CPPCHECK_WARNING: [#def121]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/record.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: GCC_ANALYZER_WARNING (CWE-476): [#def122]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/record.c: scope_hint: In function 'do_select_section'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/record.c:730:15: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'rsc'
# 728| if (flag) {
# 729| rsc = malloc(sizeof(struct record_section));
# 730|-> rsc->name = strdup(name);
# 731| rsc->next = rst->section_list.next;
# 732| rst->section_list.next = rsc;
Error: GCC_ANALYZER_WARNING (CWE-401): [#def123]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/record.c: scope_hint: In function 'get_nth_val_ent'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/record.c:849:12: warning[-Wanalyzer-malloc-leak]: leak of '*rst_44(D)->cur_row.row.vals'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/record.c: scope_hint: In function 'get_nth_val_ent'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/record.c: scope_hint: In function 'get_nth_val_ent'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/record.c: scope_hint: In function 'get_nth_val_ent'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/record.c: scope_hint: In function 'get_nth_val_ent'
# 847| }
# 848| col->nr_vals = n + 1;
# 849|-> return &col->vals[n];
# 850| }
# 851| return NULL;
Error: CPPCHECK_WARNING (CWE-401): [#def124]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/record.c:1048: error[memleakOnRealloc]: Common realloc mistake: 's' nulled but not freed upon failure
# 1046| }
# 1047|
# 1048|-> s = (char*) realloc(s, len + 2);
# 1049| s[len] = c;
# 1050| len ++;
Error: GCC_ANALYZER_WARNING (CWE-688): [#def125]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/record.c: scope_hint: In function 'read_session'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/record.c:1356:13: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'str' where non-null expected
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/record.c: scope_hint: In function 'read_session'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/record.c: scope_hint: In function 'read_session'
<built-in>: note: argument 1 of '__builtin_strlen' must be non-null
# 1354| char *str;
# 1355| str = strdup(&tokens[i][1]);
# 1356|-> str[strlen(str) - 1] = 0;
# 1357| xs = anthy_cstr_to_xstr(str, rst->encoding);
# 1358| free(str);
Error: CPPCHECK_WARNING: [#def126]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/textdict.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CPPCHECK_WARNING: [#def127]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/texttrie.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: GCC_ANALYZER_WARNING (CWE-401): [#def128]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/texttrie.c: scope_hint: In function 'find_child'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/texttrie.c:1005:12: warning[-Wanalyzer-malloc-leak]: leak of 'parent_cell.u.body.obj'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/texttrie.c:57: included_from: Included from here.
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/texttrie.c: scope_hint: In function 'find_child'
/usr/include/string.h:33: included_from: Included from here.
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/texttrie.c:62: included_from: Included from here.
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/texttrie.c: scope_hint: In function 'find_child'
# 1003|
# 1004| if (!decode_nth_node(tt, &parent_cell, parent_idx)) {
# 1005|-> return 0;
# 1006| }
# 1007|
Error: GCC_ANALYZER_WARNING (CWE-401): [#def129]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/texttrie.c:1005:12: warning[-Wanalyzer-malloc-leak]: leak of 'parent_cell.u.tail.obj'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/texttrie.c: scope_hint: In function 'find_child'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/texttrie.c: scope_hint: In function 'find_child'
# 1003|
# 1004| if (!decode_nth_node(tt, &parent_cell, parent_idx)) {
# 1005|-> return 0;
# 1006| }
# 1007|
Error: CLANG_WARNING: [#def130]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/texttrie.c:1046:7: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined
# 1044| assert(p->path);
# 1045| assert((p->cur < p->max_len) && (p->cur >= 0));
# 1046|-> key = p->path[p->cur];
# 1047| /* special case */
# 1048| if (p->cur == p->len) {
Error: CPPCHECK_WARNING: [#def131]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/word_dic.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: CPPCHECK_WARNING (CWE-457): [#def132]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/word_dic.c:658: warning[uninitvar]: Uninitialized variable: elm
# 656| off ++;
# 657| }
# 658|-> return elm;
# 659| }
# 660|
Error: CPPCHECK_WARNING: [#def133]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/word_lookup.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Error: GCC_ANALYZER_WARNING (CWE-124): [#def134]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/word_lookup.c: scope_hint: In function 'add_compound_ent'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/word_lookup.c:322:16: warning[-Wanalyzer-out-of-bounds]: stack-based buffer underwrite
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/word_lookup.c:38: included_from: Included from here.
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/word_lookup.c: scope_hint: In function 'add_compound_ent'
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/src-worddic/word_lookup.c: scope_hint: In function 'add_compound_ent'
# 320|
# 321| strncpy(buf, &ws->line[ws->offset + 1], len - 1);
# 322|-> buf[len - 1] = 0;
# 323| xs = anthy_cstr_to_xstr(buf, ws->encoding);
# 324|
Error: CPPCHECK_WARNING: [#def135]
anthy-unicode-1.0.0.20240502-build/anthy-unicode-1.0.0.20240502/test/main.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.
Scan Properties
analyzer-version-clang | 18.1.7 |
analyzer-version-cppcheck | 2.14.2 |
analyzer-version-gcc | 14.1.1 |
analyzer-version-gcc-analyzer | 14.1.1 |
analyzer-version-shellcheck | 0.10.0 |
enabled-plugins | clang, cppcheck, gcc, shellcheck |
exit-code | 0 |
host | ip-172-16-1-49.us-west-2.compute.internal |
mock-config | fedora-41-x86_64 |
project-name | anthy-unicode-1.0.0.20240502-1.fc41 |
store-results-to | /tmp/tmp_sb_b2ia/anthy-unicode-1.0.0.20240502-1.fc41.tar.xz |
time-created | 2024-07-03 11:58:47 |
time-finished | 2024-07-03 12:00:45 |
tool | csmock |
tool-args | '/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmp_sb_b2ia/anthy-unicode-1.0.0.20240502-1.fc41.tar.xz' '--gcc-analyze' '/tmp/tmp_sb_b2ia/anthy-unicode-1.0.0.20240502-1.fc41.src.rpm' |
tool-version | csmock-3.5.3-1.el9 |