BUG: QuickSurfaceMesh preflight crashes when the grid geometry has no Cell Attribute Matrix
Los mantenedores suelen responder en 3 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 76/100
Línea de trabajo
Lee QuickSurfaceMeshFilter.cpp, especialmente QuickSurfaceMeshFilter::preflightImpl() cerca de la consulta del recuento de celdas, e inspecciona QuickSurfaceMeshFilterTest.cpp. Sustituye la fuente del recuento de celdas por el recuento de celdas de la geometría y añade la prueba proporcionada para Image Geometry, además de un caso para Rectilinear Grid. Ejecuta el filtro ctest indicado; el trabajo estará terminado cuando ambos casos completen el preflight correctamente sin una Cell Attribute Matrix.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem
QuickSurfaceMesh crashes during preflight when the selected grid geometry has no Cell Attribute Matrix. Preflight reads the cell count from the geometry's Cell Attribute Matrix without checking that one exists, so it dereferences a null pointer and the process ends with a segmentation fault.
- Expected: preflight returns a result. With Attempt to Fix Problem Voxels off, Feature Ids that live outside the geometry are allowed, so a consistent input (one Feature Id per cell) should preflight cleanly.
- Actual: the application or test process crashes (SIGSEGV).
- Commit:
developat 2eb6b878f6ff408d1454754d4c0e63edd676d7e0.
Steps to Reproduce
- Create an Image Geometry with dimensions 4 x 1 x 1 and no Cell Attribute Matrix.
- Create an
int32DataArray with 4 tuples and 1 component in a DataGroup outside the geometry, for exampleElsewhere/Feature Ids. - Preflight Quick Surface Mesh with:
- Grid Geometry: the Image Geometry from step 1
- Cell Feature Ids: the array from step 2
- Attempt to Fix Problem Voxels: off
- every other parameter at its default
- Preflight crashes.
Cause
QuickSurfaceMeshFilter::preflightImpl() takes the number of cells from the Cell Attribute Matrix:
const auto& gridGeom = dataStructure.getDataRefAs<IGridGeometry>(pGridGeomDataPath);
const usize elementTupleCount = gridGeom.getCellData()->getNumberOfTuples();
IGridGeometry::getCellData() returns nullptr when no Cell Attribute Matrix is assigned. Nothing before this line checks for that:
- The Grid Geometry parameter only checks the geometry type (Image or Rectilinear Grid).
- The Cell Feature Ids parameter only checks the data type and component shape. It does not require the array to be in the geometry.
The value is used only to check the tuple count of the Cell Attribute Arrays to Transfer (error -76531):
Verification Unit Test
Add to src/Plugins/SimplnxCore/test/QuickSurfaceMeshFilterTest.cpp, with #include "simplnx/DataStructure/DataGroup.hpp" next to the other DataStructure includes:
TEST_CASE("SimplnxCore::QuickSurfaceMeshFilter: Geometry without a Cell Attribute Matrix", "[SimplnxCore][QuickSurfaceMeshFilter]")
{
UnitTest::LoadPlugins();
// The Image Geometry has 4 cells but no Cell Attribute Matrix. Feature Ids lives in a separate DataGroup
// and has one tuple per cell, so the geometry and the Feature Ids array are consistent.
DataStructure dataStructure;
auto* imageGeomPtr = ImageGeom::Create(dataStructure, "Image Geometry");
REQUIRE(imageGeomPtr != nullptr);
imageGeomPtr->setDimensions({4, 1, 1});
imageGeomPtr->setOrigin({0, 0, 0});
imageGeomPtr->setSpacing({1, 1, 1});
REQUIRE(imageGeomPtr->getCellData() == nullptr);
auto* elsewherePtr = DataGroup::Create(dataStructure, "Elsewhere");
REQUIRE(elsewherePtr != nullptr);
auto* featureIdsPtr = Int32Array::CreateWithStore<DataStore<int32>>(dataStructure, "Feature Ids", {4}, {1}, elsewherePtr->getId());
REQUIRE(featureIdsPtr != nullptr);
(*featureIdsPtr)[0] = 1;
(*featureIdsPtr)[1] = 1;
(*featureIdsPtr)[2] = 2;
(*featureIdsPtr)[3] = 2;
QuickSurfaceMeshFilter filter;
Arguments args;
args.insertOrAssign(QuickSurfaceMeshFilter::k_GridGeometryDataPath_Key, std::make_any<DataPath>(DataPath({"Image Geometry"})));
args.insertOrAssign(QuickSurfaceMeshFilter::k_CellFeatureIdsArrayPath_Key, std::make_any<DataPath>(DataPath({"Elsewhere", "Feature Ids"})));
args.insertOrAssign(QuickSurfaceMeshFilter::k_FixProblemVoxels_Key, std::make_any<bool>(false));
// Preflight must return a result. It must not dereference the missing Cell Attribute Matrix.
auto preflightResult = filter.preflight(dataStructure, args);
SIMPLNX_RESULT_REQUIRE_VALID(preflightResult.outputActions);
}
Run only this test:
ctest -R "QuickSurfaceMeshFilter: Geometry without a Cell Attribute Matrix" --output-on-failure
Output at 2eb6b87 (simplnx-Rel, macOS arm64):
QuickSurfaceMeshFilterTest.cpp:108: FAILED:
{Unknown expression after the reported line}
due to a fatal error condition:
SIGSEGV - Segmentation violation signal
test cases: 1 | 1 failed
assertions: 6 | 5 passed | 1 failed
842 - SimplnxCore::QuickSurfaceMeshFilter: Geometry without a Cell Attribute Matrix (SEGFAULT)
Proposed Fix
In QuickSurfaceMeshFilter::preflightImpl(), take the cell count from the geometry instead of its Cell Attribute Matrix:
- const usize elementTupleCount = gridGeom.getCellData()->getNumberOfTuples();
+ const usize elementTupleCount = gridGeom.getNumberOfCells();
getNumberOfCells() is the count the Cell Attribute Matrix must match, so the -76531 check on Cell Attribute Arrays to Transfer behaves the same for valid geometries. A geometry without a Cell Attribute Matrix then has no arrays to transfer, and preflight continues.
Add a Rectilinear Grid case to the test as well, because the filter accepts both geometry types.
Notes
- Found while reviewing #1829. That PR requires Feature Ids to be in the geometry's Cell Attribute Matrix only when Attempt to Fix Problem Voxels is on, and it adds a check that Feature Ids has one tuple per cell (
-76533). Neither check stops this crash when the option is off: the same line is still reached at the PR head. This was found by reading the code; the test was not run on the PR branch. - The QuickSurfaceMesh algorithm does not read the Cell Attribute Matrix during execute (checked by a search of
Algorithms/QuickSurfaceMesh*.cpp). The only dereference found is this one in preflight.
- Lenguaje dominante
- C++
- Estrellas
- 18
- Forks
- 15
- Merge medio
- 3 d 35 min
- PR fusionados (30 d)
- 25
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de BlueQuartzSoftware/simplnx
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
BlueQuartzSoftware/simplnx#1945 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
BlueQuartzSoftware/simplnx#1944 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
BlueQuartzSoftware/simplnx#1912 ·
Los mantenedores suelen responder en 3 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
BlueQuartzSoftware/simplnx#1906 ·
Los mantenedores suelen responder en 3 días
-
BUG: Compute C-Axis Locations writes a zero vector for a zero quaternionPosiblemente ocupada @jmarquisbq la tomó hace 1 día. Abiertobug Filter
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
BlueQuartzSoftware/simplnx#1891 · 1 asignado ·
Los mantenedores suelen responder en 3 días
Todos los issues de BlueQuartzSoftware/simplnx
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Niko1221/Strata#5560 · 2 comentarios ·
Los mantenedores suelen responder en 4 días
-
NVIDIA windows
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
[yugabyted] xcluster set_up and add_to_replication fail for database names containing - . or (Abiertokind/bug priority/medium qa_automation
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
yugabyte/yugabyte-db#37324 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
CharlotteCross1998/awesome-game-decompilations#61 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
godotengine/godot#125240 ·
Los mantenedores suelen responder en 1 día