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

neighbors segfaults on large out of bounds indices #33

Open
AayushSabharwal opened this issue Dec 13, 2021 · 1 comment
Open

neighbors segfaults on large out of bounds indices #33

AayushSabharwal opened this issue Dec 13, 2021 · 1 comment

Comments

@AayushSabharwal
Copy link

Trying to run neighbors on a StaticDiGraph using a sufficiently large out-of-bounds index results in a segfault.

Reproducible Example:

using Graphs
using StaticGraphs
g = SimpleDiGraph([0 1 1; 0 0 1; 0 0 0])
gg = StaticDiGraph(g)
neighbors(gg, 256222222)

Results in:

signal (11): Segmentation fault
in expression starting at REPL[14]:1
unitrange_last at ./range.jl:359 [inlined]
UnitRange at ./range.jl:354 [inlined]
Colon at ./range.jl:5 [inlined]
Colon at ./range.jl:3 [inlined]
_fvrange at /home/aayush/.julia/packages/StaticGraphs/l0WpK/src/StaticGraphs.jl:67 [inlined]
fadj at /home/aayush/.julia/packages/StaticGraphs/l0WpK/src/StaticGraphs.jl:71 [inlined]
outneighbors at /home/aayush/.julia/packages/StaticGraphs/l0WpK/src/StaticGraphs.jl:89 [inlined]
neighbors at /home/aayush/.julia/packages/Graphs/Mih78/src/core.jl:242
unknown function (ip: 0x7f63f36ba343)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1788 [inlined]
do_call at /buildworker/worker/package_linux64/build/src/interpreter.c:126
eval_value at /buildworker/worker/package_linux64/build/src/interpreter.c:215
eval_stmt_value at /buildworker/worker/package_linux64/build/src/interpreter.c:166 [inlined]
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:587
jl_interpret_toplevel_thunk at /buildworker/worker/package_linux64/build/src/interpreter.c:731
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:885
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:830
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:830
jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/toplevel.c:944
eval at ./boot.jl:373 [inlined]
eval_user_input at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:150
repl_backend_loop at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:244
start_repl_backend at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:229
#run_repl#47 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:362
run_repl at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/REPL/src/REPL.jl:349
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
#930 at ./client.jl:394
jfptr_YY.930_31132 at /home/aayush/.julia/sysimages/ohmyrepl.so (unknown line)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1788 [inlined]
jl_f__call_latest at /buildworker/worker/package_linux64/build/src/builtins.c:757
#invokelatest#2 at ./essentials.jl:716 [inlined]
invokelatest at ./essentials.jl:714 [inlined]
run_main_repl at ./client.jl:379
exec_options at ./client.jl:309
_start at ./client.jl:495
jfptr__start_38971 at /home/aayush/.julia/sysimages/ohmyrepl.so (unknown line)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1788 [inlined]
true_main at /buildworker/worker/package_linux64/build/src/jlapi.c:559
jl_repl_entrypoint at /buildworker/worker/package_linux64/build/src/jlapi.c:701
main at julia (unknown line)
__libc_start_main at /usr/lib/libc.so.6 (unknown line)
unknown function (ip: 0x400808)
Allocations: 9459103 (Pool: 9455476; Big: 3627); GC: 8
@gbaraldi
Copy link

gbaraldi commented Dec 13, 2021

Probably should be some checking in or around

@inline function _fvrange(g::AbstractStaticGraph, s::Integer)
@inbounds r_start = g.f_ind[s]
@inbounds r_end = g.f_ind[s + 1] - 1
return r_start:r_end
end

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

No branches or pull requests

2 participants