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

Bounds checking: check both lower and upper bounds during node collision resolution #109

Closed
wants to merge 1 commit into from
Closed

Bounds checking: check both lower and upper bounds during node collision resolution #109

wants to merge 1 commit into from

Conversation

jayaddison
Copy link

During development of #71, I encountered situations where the resolveCollisionsBottomToTop was being called with out-of-bounds values for the function argument i.

For consistency and safety, this change adds upper and lower bounds checks to both resolveCollisionsBottomToTop and resolveCollisionsTopToBottom.

The JSON data in use was:

{
    "nodes": [
        { "name": "Person 1", "type": "person" },
        { "name": "Person 2", "type": "person" },
        { "name": "Person 3", "type": "person" },
        { "name": "Person 4", "type": "person" },
        { "name": "Person 5", "type": "person" },
        { "name": "Project 1", "type": "project" },
        { "name": "Project 2", "type": "project" },
        { "name": "Project 3", "type": "project" },
        { "name": "Project 4", "type": "project" },
        { "name": "Project 5", "type": "project" },
        { "name": "Project 6", "type": "project" },
        { "name": "Project 7", "type": "project" },
        { "name": "Deliverable", "type": "deliverable" }
    ],
    "links": [
        {
            "source": "Person 1",
            "target": "Project 1",
            "value": 3
        },
        {
            "source": "Person 2",
            "target": "Project 2",
            "value": 1
        },
        {
            "source": "Person 3",
            "target": "Project 3",
            "value": 1
        },
        {
            "source": "Person 4",
            "target": "Project 4",
            "value": 1
        },
        {
            "source": "Person 1",
            "target": "Project 4",
            "value": 1
        },
        {
            "source": "Person 1",
            "target": "Project 3",
            "value": 1
        },
        {
            "source": "Person 1",
            "target": "Project 2",
            "value": 1
        },
        {
            "source": "Person 5",
            "target": "Project 3",
            "value": 1
        },
        {
            "source": "Person 3",
            "target": "Project 5",
            "value": 1
        },
        {
            "source": "Person 4",
            "target": "Project 6",
            "value": 1
        },
        {
            "source": "Person 2",
            "target": "Project 7",
            "value": 1
        },
        {
            "source": "Project 3",
            "target": "Deliverable",
            "value": 1
        },
        {
            "source": "Project 4",
            "target": "Deliverable",
            "value": 1
        }
    ]
}

Revives #80.

@jayaddison
Copy link
Author

Closing some old/stale pull requests.

@jayaddison jayaddison closed this Dec 29, 2022
@jayaddison jayaddison deleted the collision-bounds-checking branch December 29, 2022 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant