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

Fix segfault when numPrimitives() if called before commit() #597

Merged
merged 2 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ jobs:
artifact-in: build-ubuntu2204-arm
artifact-out: test-ubuntu2204-arm
artifact-path: build_regression_tests/tests*.xml build_regression_tests/failed*
#artifact-on-failure: true
artifact-on-failure: true

test-tutorials:
needs: build-centos8
Expand Down
2 changes: 1 addition & 1 deletion modules/cpu/geometry/Curves.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void Curves::commit()

size_t Curves::numPrimitives() const
{
return indexData->size();
return indexData ? indexData->size() : 0;
}

void Curves::createEmbreeGeometry()
Expand Down
2 changes: 1 addition & 1 deletion modules/cpu/geometry/Isosurfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void Isosurfaces::commit()

size_t Isosurfaces::numPrimitives() const
{
return isovaluesData->size();
return isovaluesData ? isovaluesData->size() : 0;
}

} // namespace ospray
Expand Down
2 changes: 1 addition & 1 deletion modules/cpu/geometry/Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ void Mesh::commit()

size_t Mesh::numPrimitives() const
{
return indexData->size();
return indexData ? indexData->size() : 0;
}

} // namespace ospray
2 changes: 1 addition & 1 deletion modules/cpu/geometry/Subdivision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ void Subdivision::commit()

size_t Subdivision::numPrimitives() const
{
return facesData->size();
return facesData ? facesData->size() : 0;
}

} // namespace ospray
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ void BilinearPatches::commit()

size_t BilinearPatches::numPrimitives() const
{
return patchesData->size() * sizeOf(patchesData->type) / sizeof(ispc::Patch);
return patchesData
? patchesData->size() * sizeOf(patchesData->type) / sizeof(ispc::Patch)
: 0;
}

} // namespace blp
Expand Down