spglib-2.6.0-1.20250512171525796309.pr581.12.g5dd9a84

List of Findings

Error: COMPILER_WARNING (CWE-477): [#def1]
spglib-2.6.0/python/py_bindings.cpp: scope_hint: In function ‘std::optional<pybind11::list> spglib::layer_dataset(array_double, array_double, array_int, pybind11::int_, pybind11::float_)’
spglib-2.6.0/python/py_bindings.cpp:256:41: warning[-Wdeprecated-declarations]: ‘SpglibDataset* spg_get_layer_dataset(const double (*)[3], const double (*)[3], const int*, int, int, double)’ is deprecated: Experimental interface. May be removed in next major release.
#  256 |     if ((dataset = spg_get_layer_dataset((double (*)[3])lattice.data(),
#      |                    ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  257 |                                          (double (*)[3])positions.data(),
#      |                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  258 |                                          atom_types.data(), atom_types.size(),
#      |                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  259 |                                          aperiodic_dir, symprec)) == nullptr)
#      |                                          ~~~~~~~~~~~~~~~~~~~~~~~
spglib-2.6.0/python/py_bindings.cpp:4: included_from: Included from here.
spglib-2.6.0/include/spglib.h:213:1: note: declared here
#  213 | spg_get_layer_dataset(double const lattice[3][3], double const position[][3],
#      | ^~~~~~~~~~~~~~~~~~~~~
#  254|                                                 py::float_ symprec) {
#  255|       SpglibDataset *dataset;
#  256|->     if ((dataset = spg_get_layer_dataset((double (*)[3])lattice.data(),
#  257|                                            (double (*)[3])positions.data(),
#  258|                                            atom_types.data(), atom_types.size(),

Error: COMPILER_WARNING (CWE-477): [#def2]
spglib-2.6.0/python/py_bindings.cpp: scope_hint: In function ‘std::optional<pybind11::int_> spglib::symmetry(array_int, array_double, array_double, array_double, array_int, pybind11::float_, pybind11::float_)’
spglib-2.6.0/python/py_bindings.cpp:376:30: warning[-Wdeprecated-declarations]: ‘int spgat_get_symmetry(int (*)[3][3], double (*)[3], int, const double (*)[3], const double (*)[3], const int*, int, double, double)’ is deprecated: Use the variables from SpglibDataset (rotations, translations)
#  376 |     return spgat_get_symmetry(
#      |            ~~~~~~~~~~~~~~~~~~^
#  377 |         (int (*)[3][3])rotations.mutable_data(),
#      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  378 |         (double (*)[3])translations.mutable_data(), rotations.shape(0),
#      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  379 |         (double (*)[3])lattice.data(), (double (*)[3])positions.data(),
#      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  380 |         atom_types.data(), atom_types.size(), symprec, angle_tolerance);
#      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
spglib-2.6.0/include/spglib.h:256:13: note: declared here
#  256 | SPG_API int spgat_get_symmetry(int rotation[][3][3], double translation[][3],
#      |             ^~~~~~~~~~~~~~~~~~
#  374|                    array_int atom_types, py::float_ symprec,
#  375|                    py::float_ angle_tolerance) {
#  376|->     return spgat_get_symmetry(
#  377|           (int (*)[3][3])rotations.mutable_data(),
#  378|           (double (*)[3])translations.mutable_data(), rotations.shape(0),

Error: COMPILER_WARNING (CWE-477): [#def3]
spglib-2.6.0/python/py_bindings.cpp: scope_hint: In function ‘std::optional<pybind11::int_> spglib::hall_number_from_symmetry(array_int, array_double, pybind11::float_)’
spglib-2.6.0/python/py_bindings.cpp:513:45: 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)
#  513 |     return spg_get_hall_number_from_symmetry((int (*)[3][3])rotations.data(),
#      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  514 |                                              (double (*)[3])translations.data(),
#      |                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  515 |                                              rotations.shape(0), symprec);
#      |                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
spglib-2.6.0/include/spglib.h:329:13: note: declared here
#  329 | SPG_API int spg_get_hall_number_from_symmetry(int const rotation[][3][3],
#      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  511|   std::optional<py::int_> spglib::hall_number_from_symmetry(
#  512|       array_int rotations, array_double translations, py::float_ symprec) {
#  513|->     return spg_get_hall_number_from_symmetry((int (*)[3][3])rotations.data(),
#  514|                                                (double (*)[3])translations.data(),
#  515|                                                rotations.shape(0), symprec);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def4]
spglib-2.6.0/redhat-linux-build/test/functional/fortran/fortran_test.c: scope_hint: In function ‘main’
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/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): [#def5]
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/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): [#def6]
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/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 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): [#def7]
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/redhat-linux-build/test/functional/fortran/fortran_test.c:35:38: note: in definition of macro ‘CM_CAST’
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 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): [#def8]
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/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): [#def9]
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/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): [#def10]
spglib-2.6.0/src/cell.c: scope_hint: In function ‘cel_free_cell’
spglib-2.6.0/src/cell.c:96:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*cell.position’
#   94|               cell->lattice = NULL;
#   95|           }
#   96|->         if (cell->position != NULL) {
#   97|               free(cell->position);
#   98|               cell->position = NULL;

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

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

Error: CPPCHECK_WARNING (CWE-457): [#def13]
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): [#def14]
spglib-2.6.0/src/delaunay.c:387: warning[uninitvar]: Uninitialized variable: succeeded
#  385|       }
#  386|   
#  387|->     if (!succeeded) {
#  388|           goto err;
#  389|       }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def15]
spglib-2.6.0/src/kpoint.c: scope_hint: In function ‘get_point_group_reciprocal_with_q’
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): [#def16]
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): [#def17]
spglib-2.6.0/src/niggli.c: scope_hint: In function ‘get_metric’
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): [#def18]
spglib-2.6.0/src/overlap.c: scope_hint: In function ‘overlap_checker_alloc’
spglib-2.6.0/src/overlap.c:502:25: warning[-Wanalyzer-allocation-size]: allocated buffer size is not a multiple of the pointee's size
#  500|       /* so a 'char *' is used. */
#  501|       chr_blob = (char *)checker->blob;
#  502|->     checker->pos_temp_1 = (double (*)[3])(chr_blob + offset_pos_temp_1);
#  503|       checker->pos_temp_2 = (double (*)[3])(chr_blob + offset_pos_temp_2);
#  504|       checker->distance_temp = (double *)(chr_blob + offset_distance_temp);

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

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

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

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

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

Error: COMPILER_WARNING (CWE-457): [#def24]
spglib-2.6.0/src/spacegroup.c: scope_hint: In function ‘match_hall_symbol_db_monocli’
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): [#def25]
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): [#def26]
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): [#def27]
spglib-2.6.0/src/spglib.c:220: error[arrayIndexOutOfBounds]: Array 'spglib_error_message[10]' accessed at index 99, which is out of bounds.
#  218|   
#  219|       for (i = 0; i < 100; i++) {
#  220|->         if (SPGERR_NONE == spglib_error_message[i].error) {
#  221|               break;
#  222|           }

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

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

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

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

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

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

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

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

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

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

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

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

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

Error: COMPILER_WARNING (CWE-477): [#def41]
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/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/test/functional/c/test_dataset_access.cpp:4: included_from: Included from here.
spglib-2.6.0/include/spglib.h:329:13: note: declared here
#  329 | 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): [#def42]
spglib-2.6.0/test/functional/c/test_magnetic_dataset.cpp:285: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: spin_flips
#  283|   
#  284|       for (i = 0; i < size; i++) {
#  285|->         time_reversals[i] = (1 - spin_flips[i]) / 2;
#  286|       }
#  287|       show_magnetic_symmetry_operations(rotations, translations, time_reversals,

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

Error: CPPCHECK_WARNING (CWE-476): [#def44]
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): [#def45]
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): [#def46]
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/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/test/functional/c/test_magnetic_symmetry.cpp:4: included_from: Included from here.
spglib-2.6.0/include/spglib.h:250:13: note: declared here
#  250 | 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): [#def47]
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): [#def48]
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): [#def49]
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/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/test/functional/c/test_spacegroup_type_search.cpp:4: included_from: Included from here.
spglib-2.6.0/include/spglib.h:369:13: note: declared here
#  369 | 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): [#def50]
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/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/include/spglib.h:383:13: note: declared here
#  383 | 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): [#def51]
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/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/test/functional/c/test_symmetry_search.cpp:4: included_from: Included from here.
spglib-2.6.0/include/spglib.h:250:13: note: declared here
#  250 | 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): [#def52]
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/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/include/spglib.h:356:13: note: declared here
#  356 | 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): [#def53]
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): [#def54]
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): [#def55]
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): [#def56]
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): [#def57]
spglib-2.6.0/test/utils.c: scope_hint: In function ‘sub_spg_standardize_cell’
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.86.0
analyzer-version-cppcheck2.17.1
analyzer-version-gcc15.1.1
analyzer-version-gcc-analyzer15.1.1
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-95.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250509.165649.g41c6174.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-namespglib-2.6.0-1.20250512171525796309.pr581.12.g5dd9a84
store-results-to/tmp/tmpbqg2ucnh/spglib-2.6.0-1.20250512171525796309.pr581.12.g5dd9a84.tar.xz
time-created2025-05-12 17:28:31
time-finished2025-05-12 17:30:17
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'unicontrol,cppcheck,gcc,clippy,shellcheck' '-o' '/tmp/tmpbqg2ucnh/spglib-2.6.0-1.20250512171525796309.pr581.12.g5dd9a84.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '/tmp/tmpbqg2ucnh/spglib-2.6.0-1.20250512171525796309.pr581.12.g5dd9a84.src.rpm'
tool-versioncsmock-3.8.1.20250422.172604.g26bc3d6-1.el9