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 potential panic on AdjacencyMap #157

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

davidovich
Copy link

Because the store could theoretically be updated without the use of the
main AddVertex and AddEdge APIs (which does some input validation),
calculating the AdjencyMap could provoke an "assignment to entry in
nil map" panic if the store reported edges that were between unknown
vertices.

Since the edges are always between known vertices, it is an error to try
and match a missing source vertex from the vertex set. If that happens,
it is a data desynchronization error that we report to the user.

In order to test this pathological case, we needed to modify the test to
use the store directly because the "front-facing" API would not allow us
to add Edges on missing vertex.

fixes #102

Signed-off-by: davidovich [email protected]

Because the store could theoretically be updated without the use of the
main `AddVertex` and `AddEdge` APIs (which does some input validation),
calculating the `AdjencyMap` could provoke an "assignment to entry in
nil map" panic if the store reported edges that were between unknown
vertices.

Since the edges are always between known vertices, it is an error to try
and match a missing source vertex from the vertex set. If that happens,
it is a data desynchronization error that we report to the user.

In order to test this pathological case, we needed to modify the test to
use the store directly because the "front-facing" API would not allow us
to add Edges on missing vertex.

fixes dominikbraun#102

Signed-off-by: davidovich <[email protected]>
@davidovich
Copy link
Author

cc @BriannHu @suarez-agu

@dominikbraun dominikbraun self-requested a review October 24, 2023 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AdjacencyMap may cause panic
1 participant