Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geometry_Set_N_Cells doesn't validate input #603

Open
GPMueller opened this issue Aug 16, 2021 · 0 comments
Open

Geometry_Set_N_Cells doesn't validate input #603

GPMueller opened this issue Aug 16, 2021 · 0 comments

Comments

@GPMueller
Copy link
Member

The entire function currently reads

    // The new number of basis cells
    auto n_cells = intfield{n_cells_i[0], n_cells_i[1], n_cells_i[2]};

    // The new geometry
    auto& old_geometry = *state->active_image->geometry;
    auto  new_geometry = Data::Geometry(old_geometry.bravais_vectors, n_cells, old_geometry.cell_atoms,
                        old_geometry.cell_composition, old_geometry.lattice_constant,
                        old_geometry.pinning, old_geometry.defects);

    // Update the State
    Helper_State_Set_Geometry(state, old_geometry, new_geometry);

    Log(Utility::Log_Level::Warning, Utility::Log_Sender::API, fmt::format("Set number of cells for all Systems: ({}, {}, {})", n_cells[0], n_cells[1], n_cells[2]), -1, -1);

This needs to be fixed! The ImGUI can be crashed by setting a zero in the GeometryWidget.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant