spglib-2.6.0-1.20250321162655004855.pr562.3.g24b8322

List of Findings

Error: COMPILER_WARNING (CWE-563): [#def1]
spglib-2.6.0-build/spglib-2.6.0/python/_spglib.c:416:19: warning[-Wunused-variable]: unused variable ‘len_list’
#  416 |     int num_atom, len_list;
#      |                   ^~~~~~~~
#  414|       double(*lat)[3];
#  415|       double(*pos)[3];
#  416|->     int num_atom, len_list;
#  417|       int *typat;
#  418|       SpglibDataset *dataset;

Error: COMPILER_WARNING (CWE-477): [#def2]
spglib-2.6.0-build/spglib-2.6.0/python/_spglib.c: scope_hint: In function ‘py_get_layerdataset’
spglib-2.6.0-build/spglib-2.6.0/python/_spglib.c:445:5: warning[-Wdeprecated-declarations]: ‘spg_get_layer_dataset’ is deprecated: Experimental interface. May be removed in next major release.
spglib-2.6.0-build/spglib-2.6.0/python/_spglib.c:9: included_from: Included from here.
spglib-2.6.0-build/spglib-2.6.0/include/spglib.h:212:24: note: declared here
#  443|       typat = (int *)PyArray_DATA(py_atom_types);
#  444|   
#  445|->     dataset = spg_get_layer_dataset(lat, pos, typat, num_atom, aperiodic_dir,
#  446|                                       symprec);
#  447|   

Error: COMPILER_WARNING (CWE-477): [#def3]
spglib-2.6.0-build/spglib-2.6.0/python/_spglib.c: scope_hint: In function ‘py_get_symmetry’
spglib-2.6.0-build/spglib-2.6.0/python/_spglib.c:1050:5: warning[-Wdeprecated-declarations]: ‘spgat_get_symmetry’ is deprecated: Use the variables from SpglibDataset (rotations, translations)
spglib-2.6.0-build/spglib-2.6.0/include/spglib.h:254:13: note: declared here
# 1048|   
# 1049|       /* num_sym has to be larger than num_sym_from_array_size. */
# 1050|->     num_sym = spgat_get_symmetry(rot, trans, num_sym_from_array_size, lat, pos,
# 1051|                                    types, num_atom, symprec, angle_tolerance);
# 1052|       return PyLong_FromLong((long)num_sym);

Error: COMPILER_WARNING (CWE-477): [#def4]
spglib-2.6.0-build/spglib-2.6.0/python/_spglib.c: scope_hint: In function ‘py_get_hall_number_from_symmetry’
spglib-2.6.0-build/spglib-2.6.0/python/_spglib.c:1461:9: warning[-Wdeprecated-declarations]: ‘spg_get_hall_number_from_symmetry’ is deprecated: Use the variable from SpglibSpacegroupType instead (hall_number)
spglib-2.6.0-build/spglib-2.6.0/include/spglib.h:327:13: note: declared here
# 1459|   
# 1460|       hall_number =
# 1461|->         spg_get_hall_number_from_symmetry(rot, trans, num_sym, symprec);
# 1462|   
# 1463|       return PyLong_FromLong((long)hall_number);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def5]
spglib-2.6.0-build/spglib-2.6.0/redhat-linux-build/test/functional/fortran/fortran_test.c: scope_hint: In function ‘main’
spglib-2.6.0-build/spglib-2.6.0/redhat-linux-build/test/functional/fortran/fortran_test.c:205:31: warning[-Wanalyzer-null-argument]: use of NULL ‘arg’ where non-null expected
spglib-2.6.0-build/spglib-2.6.0/redhat-linux-build/test/functional/fortran/fortran_test.c:35:38: note: in definition of macro ‘CM_CAST’
<built-in>: note: argument 2 of ‘__builtin_strstr’ must be non-null
#  203|     for (i = 0; i < NumTests && testToRun == -1; ++i) {
#  204|       char *test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);
#  205|->     if (partial_match != 0 && strstr(test_name, arg) != CM_NULL) { /* NOLINT */
#  206|         testToRun = i;
#  207|         ac -= 2;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def6]
spglib-2.6.0-build/spglib-2.6.0/redhat-linux-build/test/functional/fortran/fortran_test.c:205:31: warning[-Wanalyzer-null-argument]: use of NULL ‘lowercase(cmakeGeneratedFunctionMapEntries[i].name)’ where non-null expected
spglib-2.6.0-build/spglib-2.6.0/redhat-linux-build/test/functional/fortran/fortran_test.c:35:38: note: in definition of macro ‘CM_CAST’
<built-in>: note: argument 1 of ‘__builtin_strstr’ must be non-null
#  203|     for (i = 0; i < NumTests && testToRun == -1; ++i) {
#  204|       char *test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);
#  205|->     if (partial_match != 0 && strstr(test_name, arg) != CM_NULL) { /* NOLINT */
#  206|         testToRun = i;
#  207|         ac -= 2;

Error: GCC_ANALYZER_WARNING (CWE-457): [#def7]
spglib-2.6.0-build/spglib-2.6.0/redhat-linux-build/test/functional/fortran/fortran_test.c:205:31: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*<unknown>’
spglib-2.6.0-build/spglib-2.6.0/redhat-linux-build/test/functional/fortran/fortran_test.c:35:38: note: in definition of macro ‘CM_CAST’
spglib-2.6.0-build/spglib-2.6.0/redhat-linux-build/test/functional/fortran/fortran_test.c:4: included_from: Included from here.
/usr/include/string.h:350:14: note: argument 1 of ‘strstr’ must be a pointer to a null-terminated string
#  203|     for (i = 0; i < NumTests && testToRun == -1; ++i) {
#  204|       char *test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);
#  205|->     if (partial_match != 0 && strstr(test_name, arg) != CM_NULL) { /* NOLINT */
#  206|         testToRun = i;
#  207|         ac -= 2;

Error: GCC_ANALYZER_WARNING (CWE-457): [#def8]
spglib-2.6.0-build/spglib-2.6.0/redhat-linux-build/test/functional/fortran/fortran_test.c:205:31: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*arg’
spglib-2.6.0-build/spglib-2.6.0/redhat-linux-build/test/functional/fortran/fortran_test.c:35:38: note: in definition of macro ‘CM_CAST’
/usr/include/string.h:350:14: note: argument 2 of ‘strstr’ must be a pointer to a null-terminated string
#  203|     for (i = 0; i < NumTests && testToRun == -1; ++i) {
#  204|       char *test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);
#  205|->     if (partial_match != 0 && strstr(test_name, arg) != CM_NULL) { /* NOLINT */
#  206|         testToRun = i;
#  207|         ac -= 2;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def9]
spglib-2.6.0-build/spglib-2.6.0/redhat-linux-build/test/functional/fortran/fortran_test.c:209:38: warning[-Wanalyzer-null-argument]: use of NULL ‘arg’ where non-null expected
spglib-2.6.0-build/spglib-2.6.0/redhat-linux-build/test/functional/fortran/fortran_test.c:35:38: note: in definition of macro ‘CM_CAST’
/usr/include/string.h:156:12: note: argument 2 of ‘strcmp’ must be non-null
#  207|         ac -= 2;
#  208|         av += 2;
#  209|->     } else if (partial_match == 0 && strcmp(test_name, arg) == 0) {
#  210|         testToRun = i;
#  211|         ac--;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def10]
spglib-2.6.0-build/spglib-2.6.0/redhat-linux-build/test/functional/fortran/fortran_test.c:209:38: warning[-Wanalyzer-null-argument]: use of NULL ‘lowercase(cmakeGeneratedFunctionMapEntries[i].name)’ where non-null expected
spglib-2.6.0-build/spglib-2.6.0/redhat-linux-build/test/functional/fortran/fortran_test.c:35:38: note: in definition of macro ‘CM_CAST’
/usr/include/string.h:156:12: note: argument 1 of ‘strcmp’ must be non-null
#  207|         ac -= 2;
#  208|         av += 2;
#  209|->     } else if (partial_match == 0 && strcmp(test_name, arg) == 0) {
#  210|         testToRun = i;
#  211|         ac--;

Error: GCC_ANALYZER_WARNING (CWE-457): [#def11]
spglib-2.6.0-build/spglib-2.6.0/src/cell.c: scope_hint: In function ‘cel_free_cell’
spglib-2.6.0-build/spglib-2.6.0/src/cell.c:95:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*cell.position’
#   93|               cell->lattice = NULL;
#   94|           }
#   95|->         if (cell->position != NULL) {
#   96|               free(cell->position);
#   97|               cell->position = NULL;

Error: GCC_ANALYZER_WARNING (CWE-457): [#def12]
spglib-2.6.0-build/spglib-2.6.0/src/cell.c:103:18: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*cell.tensor_rank’
#  101|               cell->types = NULL;
#  102|           }
#  103|->         if ((cell->tensor_rank != NOSPIN) && (cell->tensors != NULL)) {
#  104|               // When cell->tensor_rank==NOSPIN, cell->tensors is already
#  105|               // NULL.

Error: GCC_ANALYZER_WARNING (CWE-457): [#def13]
spglib-2.6.0-build/spglib-2.6.0/src/cell.c:103:51: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*cell.tensors’
#  101|               cell->types = NULL;
#  102|           }
#  103|->         if ((cell->tensor_rank != NOSPIN) && (cell->tensors != NULL)) {
#  104|               // When cell->tensor_rank==NOSPIN, cell->tensors is already
#  105|               // NULL.

Error: CPPCHECK_WARNING (CWE-457): [#def14]
spglib-2.6.0-build/spglib-2.6.0/src/delaunay.c:95: warning[uninitvar]: Uninitialized variable: succeeded
#   93|       }
#   94|   
#   95|->     if (!succeeded) {
#   96|           goto err;
#   97|       }

Error: CPPCHECK_WARNING (CWE-457): [#def15]
spglib-2.6.0-build/spglib-2.6.0/src/delaunay.c:388: warning[uninitvar]: Uninitialized variable: succeeded
#  386|       }
#  387|   
#  388|->     if (!succeeded) {
#  389|           goto err;
#  390|       }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def16]
spglib-2.6.0-build/spglib-2.6.0/src/kpoint.c: scope_hint: In function ‘get_point_group_reciprocal_with_q’
spglib-2.6.0-build/spglib-2.6.0/src/kpoint.c:358:61: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘rot_reciprocal’
#  356|       num_rot = 0;
#  357|   
#  358|->     if ((ir_rot = (int *)malloc(sizeof(int) * rot_reciprocal->size)) == NULL) {
#  359|           warning_memory("ir_rot");
#  360|           return NULL;

Error: CPPCHECK_WARNING (CWE-457): [#def17]
spglib-2.6.0-build/spglib-2.6.0/src/niggli.c:105: error[uninitvar]: Uninitialized variable: p
#  103|       int succeeded;
#  104|       NiggliParams *p;
#  105|->     int (*steps[8])(NiggliParams *p) = {step1, step2, step3, step4,
#  106|                                           step5, step6, step7, step8};
#  107|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def18]
spglib-2.6.0-build/spglib-2.6.0/src/niggli.c: scope_hint: In function ‘get_metric’
spglib-2.6.0-build/spglib-2.6.0/src/niggli.c:485:34: warning[-Wanalyzer-malloc-leak]: leak of ‘get_transpose(M)’
#  483|       for (i = 0; i < 3; i++) {
#  484|           for (j = 0; j < 3; j++) {
#  485|->             M_T[i * 3 + j] = M[j * 3 + i];
#  486|           }
#  487|       }

Error: GCC_ANALYZER_WARNING (CWE-131): [#def19]
spglib-2.6.0-build/spglib-2.6.0/src/overlap.c: scope_hint: In function ‘overlap_checker_alloc’
spglib-2.6.0-build/spglib-2.6.0/src/overlap.c:500:25: warning[-Wanalyzer-allocation-size]: allocated buffer size is not a multiple of the pointee's size
#  498|       /* so a 'char *' is used. */
#  499|       chr_blob = (char *)checker->blob;
#  500|->     checker->pos_temp_1 = (double(*)[3])(chr_blob + offset_pos_temp_1);
#  501|       checker->pos_temp_2 = (double(*)[3])(chr_blob + offset_pos_temp_2);
#  502|       checker->distance_temp = (double *)(chr_blob + offset_distance_temp);

Error: CPPCHECK_WARNING (CWE-457): [#def20]
spglib-2.6.0-build/spglib-2.6.0/src/pointgroup.c:378: warning[uninitvar]: Uninitialized variables: pointgroup.holohedry, pointgroup.laue
#  376|       }
#  377|   
#  378|->     return pointgroup;
#  379|   }
#  380|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def21]
spglib-2.6.0-build/spglib-2.6.0/src/primitive.c: scope_hint: In function ‘get_primitive_in_translation_space’
spglib-2.6.0-build/spglib-2.6.0/src/primitive.c:656:18: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
#  654|       cell = NULL;
#  655|   
#  656|->     if (primitive->cell->size != 1) {
#  657|           prm_free_primitive(primitive);
#  658|           primitive = NULL;

Error: CPPCHECK_WARNING (CWE-476): [#def22]
spglib-2.6.0-build/spglib-2.6.0/src/site_symmetry.c:342: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: nums_equiv_atoms
#  340|       nums_equiv_atoms = (int *)malloc(sizeof(int) * conv_prim->size);
#  341|       for (i = 0; i < conv_prim->size; i++) {
#  342|->         nums_equiv_atoms[i] = 0;
#  343|       }
#  344|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def23]
spglib-2.6.0-build/spglib-2.6.0/src/site_symmetry.c: scope_hint: In function ‘set_Wyckoffs_labels’
spglib-2.6.0-build/spglib-2.6.0/src/site_symmetry.c:342:29: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘nums_equiv_atoms’
#  340|       nums_equiv_atoms = (int *)malloc(sizeof(int) * conv_prim->size);
#  341|       for (i = 0; i < conv_prim->size; i++) {
#  342|->         nums_equiv_atoms[i] = 0;
#  343|       }
#  344|   

Error: CPPCHECK_WARNING (CWE-476): [#def24]
spglib-2.6.0-build/spglib-2.6.0/src/site_symmetry.c:346: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: nums_equiv_atoms
#  344|   
#  345|       for (i = 0; i < conv_prim->size; i++) {
#  346|->         nums_equiv_atoms[equiv_atoms[i]]++;
#  347|       }
#  348|   

Error: COMPILER_WARNING (CWE-457): [#def25]
spglib-2.6.0-build/spglib-2.6.0/src/spacegroup.c:1064:17: warning[-Wmaybe-uninitialized]: ‘num_free_axes’ may be used uninitialized
# 1064 |             if (match_hall_symbol_db_ortho(origin_shift, conv_lattice,
#      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1065 |                                            orig_lattice, hall_number, centering,
#      |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 1066 |                                            symmetry, num_free_axes, symprec)) {
#      |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
spglib-2.6.0-build/spglib-2.6.0/src/spacegroup.c: scope_hint: In function ‘search_hall_number’
spglib-2.6.0-build/spglib-2.6.0/src/spacegroup.c:996:19: note: ‘num_free_axes’ was declared here
#  996 |     int is_found, num_free_axes;
#      |                   ^~~~~~~~~~~~~
# 1062|               }
# 1063|   
# 1064|->             if (match_hall_symbol_db_ortho(origin_shift, conv_lattice,
# 1065|                                              orig_lattice, hall_number, centering,
# 1066|                                              symmetry, num_free_axes, symprec)) {

Error: COMPILER_WARNING (CWE-457): [#def26]
spglib-2.6.0-build/spglib-2.6.0/src/spacegroup.c: scope_hint: In function ‘match_hall_symbol_db_monocli’
spglib-2.6.0-build/spglib-2.6.0/src/spacegroup.c:1116:51: warning[-Wmaybe-uninitialized]: ‘j’ may be used uninitialized
# 1116 |     int i, check_norms, i_shortest, is_found_any, j, num_change_of_basis;
#      |                                                   ^
# 1114|       int const group_number, Centering const centering,
# 1115|       Symmetry const *conv_symmetry, double const symprec) {
# 1116|->     int i, check_norms, i_shortest, is_found_any, j, num_change_of_basis;
# 1117|       int is_found[36];
# 1118|       double shortest_norm_sum, norm_sum;

Error: CPPCHECK_WARNING (CWE-786): [#def27]
spglib-2.6.0-build/spglib-2.6.0/src/spacegroup.c:1219: error[negativeIndex]: Array 'all_origin_shifts[36][3]' accessed at index -1, which is out of bounds.
# 1217|       }
# 1218|   
# 1219|->     mat_copy_vector_d3(origin_shift, all_origin_shifts[i_shortest]);
# 1220|       mat_copy_matrix_d3(conv_lattice, all_conv_lattices[i_shortest]);
# 1221|       return 1;

Error: CPPCHECK_WARNING (CWE-786): [#def28]
spglib-2.6.0-build/spglib-2.6.0/src/spacegroup.c:1220: error[negativeIndex]: Array 'all_conv_lattices[36][3][3]' accessed at index -1, which is out of bounds.
# 1218|   
# 1219|       mat_copy_vector_d3(origin_shift, all_origin_shifts[i_shortest]);
# 1220|->     mat_copy_matrix_d3(conv_lattice, all_conv_lattices[i_shortest]);
# 1221|       return 1;
# 1222|   

Error: CPPCHECK_WARNING (CWE-823): [#def29]
spglib-2.6.0-build/spglib-2.6.0/src/spglib.c:218: error[arrayIndexOutOfBounds]: Array 'spglib_error_message[10]' accessed at index 99, which is out of bounds.
#  216|   
#  217|       for (i = 0; i < 100; i++) {
#  218|->         if (SPGERR_NONE == spglib_error_message[i].error) {
#  219|               break;
#  220|           }

Error: CPPCHECK_WARNING (CWE-401): [#def30]
spglib-2.6.0-build/spglib-2.6.0/src/spin.c:182: error[memleak]: Memory leak: inv_perm
#  180|   
#  181|       if ((exact_cell = cel_alloc_cell(cell->size, cell->tensor_rank)) == NULL) {
#  182|->         return NULL;
#  183|       }
#  184|       mat_copy_matrix_d3(exact_cell->lattice, cell->lattice);

Error: CPPCHECK_WARNING (CWE-401): [#def31]
spglib-2.6.0-build/spglib-2.6.0/src/spin.c:190: error[memleak]: Memory leak: inv_perm
#  188|       if ((rotations_cart = (double(*)[3][3])malloc(
#  189|                sizeof(double[3][3]) * magnetic_symmetry->size)) == NULL) {
#  190|->         return NULL;
#  191|       }
#  192|       set_rotations_in_cartesian(rotations_cart, cell->lattice,

Error: GCC_ANALYZER_WARNING (CWE-457): [#def32]
spglib-2.6.0-build/spglib-2.6.0/src/spin.c: scope_hint: In function ‘spn_get_idealized_cell’
spglib-2.6.0-build/spglib-2.6.0/src/spin.c:216:15: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*<unknown>’
#  214|               }
#  215|   
#  216|->             j = inv_perm[i]; /* p-th operation maps site-j to site-i */
#  217|   
#  218|               apply_symmetry_to_position(pos_tmp, cell->position[j],

Error: GCC_ANALYZER_WARNING (CWE-457): [#def33]
spglib-2.6.0-build/spglib-2.6.0/src/spin.c: scope_hint: In function ‘get_symmetry_permutations’
spglib-2.6.0-build/spglib-2.6.0/src/spin.c:584:47: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘scalar’
#  582|                               i, scalar, j, cell->tensors[j]);
#  583|                   if (cell->tensor_rank == COLLINEAR &&
#  584|->                     !is_zero(cell->tensors[j] - scalar, mag_symprec)) {
#  585|                       continue;
#  586|                   }

Error: COMPILER_WARNING (CWE-457): [#def34]
spglib-2.6.0-build/spglib-2.6.0/src/spin.c:584:47: warning[-Wmaybe-uninitialized]: ‘scalar’ may be used uninitialized
#  584 |                     !is_zero(cell->tensors[j] - scalar, mag_symprec)) {
#      |                              ~~~~~~~~~~~~~~~~~^~~~~~~~
spglib-2.6.0-build/spglib-2.6.0/src/spin.c: scope_hint: In function ‘spn_get_operations_with_site_tensors’
spglib-2.6.0-build/spglib-2.6.0/src/spin.c:533:12: note: ‘scalar’ was declared here
#  533 |     double scalar;
#      |            ^~~~~~
#  582|                               i, scalar, j, cell->tensors[j]);
#  583|                   if (cell->tensor_rank == COLLINEAR &&
#  584|->                     !is_zero(cell->tensors[j] - scalar, mag_symprec)) {
#  585|                       continue;
#  586|                   }

Error: GCC_ANALYZER_WARNING (CWE-457): [#def35]
spglib-2.6.0-build/spglib-2.6.0/src/spin.c:588:60: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘vector[0]’
#  586|                   }
#  587|                   if (cell->tensor_rank == NONCOLLINEAR) {
#  588|->                     diff[0] = cell->tensors[3 * j] - vector[0];
#  589|                       diff[1] = cell->tensors[3 * j + 1] - vector[1];
#  590|                       diff[2] = cell->tensors[3 * j + 2] - vector[2];

Error: CPPCHECK_WARNING (CWE-476): [#def36]
spglib-2.6.0-build/spglib-2.6.0/src/symmetry.c:527: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: copy_atoms_found
#  525|       copy_atoms_found = (int *)malloc(sizeof(int) * cell->size);
#  526|       for (i = 0; i < cell->size; i++) {
#  527|->         copy_atoms_found[i] = atoms_found[i];
#  528|       }
#  529|   

Error: CPPCHECK_WARNING (CWE-476): [#def37]
spglib-2.6.0-build/spglib-2.6.0/src/symmetry.c:531: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: copy_atoms_found
#  529|   
#  530|       for (initial_atom = 0; initial_atom < cell->size; initial_atom++) {
#  531|->         if (!copy_atoms_found[initial_atom]) {
#  532|               continue;
#  533|           }

Error: CPPCHECK_WARNING (CWE-476): [#def38]
spglib-2.6.0-build/spglib-2.6.0/src/symmetry.c:770: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: copy_atoms_found
#  768|       copy_atoms_found = (int *)malloc(sizeof(int) * cell->size);
#  769|       for (i = 0; i < cell->size; i++) {
#  770|->         copy_atoms_found[i] = atoms_found[i];
#  771|       }
#  772|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def39]
spglib-2.6.0-build/spglib-2.6.0/src/symmetry.c: scope_hint: In function ‘search_layer_pure_translations’
spglib-2.6.0-build/spglib-2.6.0/src/symmetry.c:770:29: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘copy_atoms_found’
#  768|       copy_atoms_found = (int *)malloc(sizeof(int) * cell->size);
#  769|       for (i = 0; i < cell->size; i++) {
#  770|->         copy_atoms_found[i] = atoms_found[i];
#  771|       }
#  772|   

Error: CPPCHECK_WARNING (CWE-476): [#def40]
spglib-2.6.0-build/spglib-2.6.0/src/symmetry.c:774: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: copy_atoms_found
#  772|   
#  773|       for (initial_atom = 0; initial_atom < cell->size; initial_atom++) {
#  774|->         if (!copy_atoms_found[initial_atom]) {
#  775|               continue;
#  776|           }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def41]
spglib-2.6.0-build/spglib-2.6.0/src/symmetry.c:774:30: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘copy_atoms_found’
#  772|   
#  773|       for (initial_atom = 0; initial_atom < cell->size; initial_atom++) {
#  774|->         if (!copy_atoms_found[initial_atom]) {
#  775|               continue;
#  776|           }

Error: GCC_ANALYZER_WARNING (CWE-457): [#def42]
spglib-2.6.0-build/spglib-2.6.0/src/symmetry.c:774:30: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*<unknown>’
#  772|   
#  773|       for (initial_atom = 0; initial_atom < cell->size; initial_atom++) {
#  774|->         if (!copy_atoms_found[initial_atom]) {
#  775|               continue;
#  776|           }

Error: COMPILER_WARNING (CWE-477): [#def43]
spglib-2.6.0-build/spglib-2.6.0/test/functional/c/test_dataset_access.cpp: scope_hint: In member function ‘virtual void DatasetAccess_test_spg_get_hall_number_from_symmetry_Test::TestBody()’
spglib-2.6.0-build/spglib-2.6.0/test/functional/c/test_dataset_access.cpp:37:52: warning[-Wdeprecated-declarations]: ‘int spg_get_hall_number_from_symmetry(const int (*)[3][3], const double (*)[3], int, double)’ is deprecated: Use the variable from SpglibSpacegroupType instead (hall_number)
#   37 |     hall_number = spg_get_hall_number_from_symmetry(
#      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
#   38 |         dataset->rotations, dataset->translations, dataset->n_operations,
#      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   39 |         symprec);
#      |         ~~~~~~~~                                    
spglib-2.6.0-build/spglib-2.6.0/test/functional/c/test_dataset_access.cpp:4: included_from: Included from here.
spglib-2.6.0-build/spglib-2.6.0/include/spglib.h:327:13: note: declared here
#  327 | SPG_API int spg_get_hall_number_from_symmetry(int const rotation[][3][3],
#      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   35|       printf("hall_number = %d is found by spg_get_dataset.\n",
#   36|              dataset->hall_number);
#   37|->     hall_number = spg_get_hall_number_from_symmetry(
#   38|           dataset->rotations, dataset->translations, dataset->n_operations,
#   39|           symprec);

Error: CPPCHECK_WARNING (CWE-476): [#def44]
spglib-2.6.0-build/spglib-2.6.0/test/functional/c/test_magnetic_dataset.cpp:284: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: spin_flips
#  282|   
#  283|       for (i = 0; i < size; i++) {
#  284|->         time_reversals[i] = (1 - spin_flips[i]) / 2;
#  285|       }
#  286|       show_magnetic_symmetry_operations(rotations, translations, time_reversals,

Error: CPPCHECK_WARNING (CWE-476): [#def45]
spglib-2.6.0-build/spglib-2.6.0/test/functional/c/test_magnetic_dataset.cpp:284: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: time_reversals
#  282|   
#  283|       for (i = 0; i < size; i++) {
#  284|->         time_reversals[i] = (1 - spin_flips[i]) / 2;
#  285|       }
#  286|       show_magnetic_symmetry_operations(rotations, translations, time_reversals,

Error: CPPCHECK_WARNING (CWE-476): [#def46]
spglib-2.6.0-build/spglib-2.6.0/test/functional/c/test_magnetic_symmetry.cpp:161: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: spin_flips
#  159|       time_reversals = (int *)malloc(sizeof(int *) * size);
#  160|       for (i = 0; i < size; i++) {
#  161|->         time_reversals[i] = (1 - spin_flips[i]) / 2;
#  162|       }
#  163|       SpglibMagneticSpacegroupType msgtype =

Error: CPPCHECK_WARNING (CWE-476): [#def47]
spglib-2.6.0-build/spglib-2.6.0/test/functional/c/test_magnetic_symmetry.cpp:161: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: time_reversals
#  159|       time_reversals = (int *)malloc(sizeof(int *) * size);
#  160|       for (i = 0; i < size; i++) {
#  161|->         time_reversals[i] = (1 - spin_flips[i]) / 2;
#  162|       }
#  163|       SpglibMagneticSpacegroupType msgtype =

Error: COMPILER_WARNING (CWE-477): [#def48]
spglib-2.6.0-build/spglib-2.6.0/test/functional/c/test_magnetic_symmetry.cpp: scope_hint: In member function ‘virtual void MagneticSymmetry_test_spg_get_symmetry_with_tensors_rough_symprec_Test::TestBody()’
spglib-2.6.0-build/spglib-2.6.0/test/functional/c/test_magnetic_symmetry.cpp:224:28: warning[-Wdeprecated-declarations]: ‘int spg_get_symmetry(int (*)[3][3], double (*)[3], int, const double (*)[3], const double (*)[3], const int*, int, double)’ is deprecated: Use the variables from SpglibDataset (rotations, translations)
#  224 |     size = spg_get_symmetry(rotations, translations, max_size, lattice,
#      |            ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  225 |                             positions, types, num_atoms, symprec);
#      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
spglib-2.6.0-build/spglib-2.6.0/test/functional/c/test_magnetic_symmetry.cpp:4: included_from: Included from here.
spglib-2.6.0-build/spglib-2.6.0/include/spglib.h:248:13: note: declared here
#  248 | SPG_API int spg_get_symmetry(int rotation[][3][3], double translation[][3],
#      |             ^~~~~~~~~~~~~~~~
#  222|       time_reversals = (int *)malloc(sizeof(int *) * max_size);
#  223|   
#  224|->     size = spg_get_symmetry(rotations, translations, max_size, lattice,
#  225|                               positions, types, num_atoms, symprec);
#  226|       ASSERT_EQ(size, 4);

Error: CPPCHECK_WARNING (CWE-476): [#def49]
spglib-2.6.0-build/spglib-2.6.0/test/functional/c/test_magnetic_symmetry.cpp:237: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: spin_flips
#  235|   
#  236|       for (i = 0; i < size; i++) {
#  237|->         time_reversals[i] = (1 - spin_flips[i]) / 2;
#  238|       }
#  239|       show_magnetic_symmetry_operations(rotations, translations, time_reversals,

Error: CPPCHECK_WARNING (CWE-476): [#def50]
spglib-2.6.0-build/spglib-2.6.0/test/functional/c/test_magnetic_symmetry.cpp:237: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: time_reversals
#  235|   
#  236|       for (i = 0; i < size; i++) {
#  237|->         time_reversals[i] = (1 - spin_flips[i]) / 2;
#  238|       }
#  239|       show_magnetic_symmetry_operations(rotations, translations, time_reversals,

Error: COMPILER_WARNING (CWE-477): [#def51]
spglib-2.6.0-build/spglib-2.6.0/test/functional/c/test_spacegroup_type_search.cpp: scope_hint: In member function ‘virtual void SpacegroupTypeSearch_test_spg_get_international_Test::TestBody()’
spglib-2.6.0-build/spglib-2.6.0/test/functional/c/test_spacegroup_type_search.cpp:20:30: warning[-Wdeprecated-declarations]: ‘int spg_get_international(char*, const double (*)[3], const double (*)[3], const int*, int, double)’ is deprecated: Use the variables from SpglibDataset (spacegroup_number, international_symbol)
#   20 |         spg_get_international(symbol, lattice, position, types, num_atom, 1e-5);
#      |         ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
spglib-2.6.0-build/spglib-2.6.0/test/functional/c/test_spacegroup_type_search.cpp:4: included_from: Included from here.
spglib-2.6.0-build/spglib-2.6.0/include/spglib.h:368:13: note: declared here
#  368 | SPG_API int spg_get_international(char symbol[11], double const lattice[3][3],
#      |             ^~~~~~~~~~~~~~~~~~~~~
#   18|   
#   19|       num_spg =
#   20|->         spg_get_international(symbol, lattice, position, types, num_atom, 1e-5);
#   21|       ASSERT_EQ(num_spg, 136);
#   22|       ASSERT_STREQ(symbol, symbol_expect);

Error: COMPILER_WARNING (CWE-477): [#def52]
spglib-2.6.0-build/spglib-2.6.0/test/functional/c/test_spacegroup_type_search.cpp: scope_hint: In member function ‘virtual void SpacegroupTypeSearch_test_spg_get_schoenflies_Test::TestBody()’
spglib-2.6.0-build/spglib-2.6.0/test/functional/c/test_spacegroup_type_search.cpp:38:28: warning[-Wdeprecated-declarations]: ‘int spg_get_schoenflies(char*, const double (*)[3], const double (*)[3], const int*, int, double)’ is deprecated: Use the variables from SpglibDataset (spacegroup_number, international_symbol)
#   38 |         spg_get_schoenflies(symbol, lattice, position, types, num_atom, 1e-5);
#      |         ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
spglib-2.6.0-build/spglib-2.6.0/include/spglib.h:384:13: note: declared here
#  384 | SPG_API int spg_get_schoenflies(char symbol[7], double const lattice[3][3],
#      |             ^~~~~~~~~~~~~~~~~~~
#   36|   
#   37|       num_spg =
#   38|->         spg_get_schoenflies(symbol, lattice, position, types, num_atom, 1e-5);
#   39|       ASSERT_EQ(num_spg, 136);
#   40|       ASSERT_STREQ(symbol, symbol_expect);

Error: COMPILER_WARNING (CWE-477): [#def53]
spglib-2.6.0-build/spglib-2.6.0/test/functional/c/test_symmetry_search.cpp: scope_hint: In member function ‘virtual void SymmetrySearch_test_spg_get_symmetry_Test::TestBody()’
spglib-2.6.0-build/spglib-2.6.0/test/functional/c/test_symmetry_search.cpp:33:28: warning[-Wdeprecated-declarations]: ‘int spg_get_symmetry(int (*)[3][3], double (*)[3], int, const double (*)[3], const double (*)[3], const int*, int, double)’ is deprecated: Use the variables from SpglibDataset (rotations, translations)
#   33 |     size = spg_get_symmetry(rotation, translation, max_size, lattice, position,
#      |            ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   34 |                             types, num_atom, 1e-5);
#      |                             ~~~~~~~~~~~~~~~~~~~~~~
spglib-2.6.0-build/spglib-2.6.0/test/functional/c/test_symmetry_search.cpp:4: included_from: Included from here.
spglib-2.6.0-build/spglib-2.6.0/include/spglib.h:248:13: note: declared here
#  248 | SPG_API int spg_get_symmetry(int rotation[][3][3], double translation[][3],
#      |             ^~~~~~~~~~~~~~~~
#   31|   
#   32|       printf("*** spg_get_symmetry (Rutile two unit cells) ***:\n");
#   33|->     size = spg_get_symmetry(rotation, translation, max_size, lattice, position,
#   34|                               types, num_atom, 1e-5);
#   35|       ASSERT_EQ(size, 32);

Error: COMPILER_WARNING (CWE-477): [#def54]
spglib-2.6.0-build/spglib-2.6.0/test/functional/c/test_symmetry_search.cpp: scope_hint: In member function ‘virtual void SymmetrySearch_test_spg_get_multiplicity_Test::TestBody()’
spglib-2.6.0-build/spglib-2.6.0/test/functional/c/test_symmetry_search.cpp:81:32: warning[-Wdeprecated-declarations]: ‘int spg_get_multiplicity(const double (*)[3], const double (*)[3], const int*, int, double)’ is deprecated: Use the variables from SpglibDataset (n_operations)
#   81 |     size = spg_get_multiplicity(lattice, position, types, num_atom, 1e-5);
#      |            ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
spglib-2.6.0-build/spglib-2.6.0/include/spglib.h:354:13: note: declared here
#  354 | SPG_API int spg_get_multiplicity(double const lattice[3][3],
#      |             ^~~~~~~~~~~~~~~~~~~~
#   79|       int size;
#   80|   
#   81|->     size = spg_get_multiplicity(lattice, position, types, num_atom, 1e-5);
#   82|       ASSERT_EQ(size, 48);
#   83|   }

Error: CPPCHECK_WARNING (CWE-476): [#def55]
spglib-2.6.0-build/spglib-2.6.0/test/utils.c:156: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pos
#  154|   
#  155|       for (i = 0; i < num_atom; i++) {
#  156|->         pos[i][0] = position[i][0];
#  157|           pos[i][1] = position[i][1];
#  158|           pos[i][2] = position[i][2];

Error: CPPCHECK_WARNING (CWE-476): [#def56]
spglib-2.6.0-build/spglib-2.6.0/test/utils.c:157: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pos
#  155|       for (i = 0; i < num_atom; i++) {
#  156|           pos[i][0] = position[i][0];
#  157|->         pos[i][1] = position[i][1];
#  158|           pos[i][2] = position[i][2];
#  159|           typ[i] = types[i];

Error: CPPCHECK_WARNING (CWE-476): [#def57]
spglib-2.6.0-build/spglib-2.6.0/test/utils.c:158: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pos
#  156|           pos[i][0] = position[i][0];
#  157|           pos[i][1] = position[i][1];
#  158|->         pos[i][2] = position[i][2];
#  159|           typ[i] = types[i];
#  160|       }

Error: CPPCHECK_WARNING (CWE-476): [#def58]
spglib-2.6.0-build/spglib-2.6.0/test/utils.c:159: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: typ
#  157|           pos[i][1] = position[i][1];
#  158|           pos[i][2] = position[i][2];
#  159|->         typ[i] = types[i];
#  160|       }
#  161|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def59]
spglib-2.6.0-build/spglib-2.6.0/test/utils.c: scope_hint: In function ‘sub_spg_standardize_cell’
spglib-2.6.0-build/spglib-2.6.0/test/utils.c:159:16: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘typ’
#  157|           pos[i][1] = position[i][1];
#  158|           pos[i][2] = position[i][2];
#  159|->         typ[i] = types[i];
#  160|       }
#  161|   

Scan Properties

analyzer-version-clippy1.85.1
analyzer-version-cppcheck2.17 dev
analyzer-version-gcc15.0.1
analyzer-version-gcc-analyzer15.0.1
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-106.us-west-2.compute.internal
mock-configfedora-rawhide-x86_64
project-namespglib-2.6.0-1.20250321162655004855.pr562.3.g24b8322
store-results-to/tmp/tmp44s7b0a0/spglib-2.6.0-1.20250321162655004855.pr562.3.g24b8322.tar.xz
time-created2025-03-21 16:38:59
time-finished2025-03-21 16:40:34
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'shellcheck,unicontrol,clippy,gcc,cppcheck' '-o' '/tmp/tmp44s7b0a0/spglib-2.6.0-1.20250321162655004855.pr562.3.g24b8322.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '/tmp/tmp44s7b0a0/spglib-2.6.0-1.20250321162655004855.pr562.3.g24b8322.src.rpm'
tool-versioncsmock-3.8.0-1.el9