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

Segfault running Dijkstra path finding example #310

Closed
tomassedovic opened this issue Jul 6, 2020 · 1 comment · Fixed by #317
Closed

Segfault running Dijkstra path finding example #310

tomassedovic opened this issue Jul 6, 2020 · 1 comment · Fixed by #317

Comments

@tomassedovic
Copy link
Owner

$ cargo run --example dijkstra-path-finding
   Compiling tcod-sys v6.0.0 (/home/shadower/code/tcod-rs/tcod_sys)
   Compiling tcod v0.15.0 (/home/shadower/code/tcod-rs)
    Finished dev [unoptimized + debuginfo] target(s) in 7.46s
     Running `target/debug/examples/dijkstra-path-finding`
Starting from: (4, 6)
Walking to: (4, 6)
Walking to: (3, 5)
Walking to: (2, 4)
Walking to: (1, 3)
Walking to: (0, 2)
Walking to: (1, 1)
Arrived at the destination!

Starting from: (0, 6)
Walking to: (0, 6)
Walking to: (1, 5)
Walking to: (0, 4)
Walking to: (1, 3)
Walking to: (0, 2)
Walking to: (1, 1)
Arrived at the destination!

fish: “cargo run --example dijkstra-pa…” terminated by signal SIGSEGV (Address boundary error)

This happens both with the current tcod-rs release (0.15.0) and with: #309

I suspect that means the error is probably in our bindings rather than libtcod itself, but maybe it is just a long-standing issue in the original codebase.

@ojhp
Copy link
Collaborator

ojhp commented Jan 25, 2021

Looks like an issue in libtcod itself where it can't reverse an empty list (the example that breaks is finding a path from the origin to itself). Can be protected against by checking for an empty list before calling the reverse function. A* is unaffected by this issue as far as I can see.

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 a pull request may close this issue.

2 participants