sequential_vertex_coloring out-of-bounds memory access
Maintainers usually reply within 1 day
@Becheler is already working on this.
Since Oct 7, 2026.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start with sequential_vertex_coloring.hpp and the attached tests.cpp reproducer. Check how the default order property map is built and used when the graph is filtered and no order property map is supplied. Run the reproducer on both the original and filtered graphs; done means the filtered-graph call completes without an out-of-bounds access.
Written by the indexing model from the issue text.
Description
The algorithm encoded in sequential_vertex_coloring.hpp accesses memory out of bounds when called with (i) a filtered graph, i.e., one for which num_vertices(g) > distance(vertices(g).first,vertices(g).second), and (ii) no order property map. This is because, for a filtered graph, the order property map constructed by the algorithm is too small. The algorithm documents the order property map to have the following property:
A mapping from integers in the range [0, num_vertices(g)) to the vertices of the graph.
However, it is constructed from vertices(g), not num_vertices(g). For filtered graphs, the former range may be smaller than the latter, yet the algorithm itself accesses all the vertices returned by num_vertices(g), i.e., in the range referred to above. Therefore, out-of-bounds memory access is possible.
See below for a reproducer and a patch that works for me. Although I have tested this only on Boost v1.86.0, the file in question is unchanged for seven years and contains the same code.
Before filing
- [ x] I searched the existing issues and did not find a duplicate.
- [x ] I have reproduced the bug against the
developbranch or the latest Boost release. - [x ] I have a minimal reproducer (or I will paste my full failing code below).
Boost version
1.86.0
Compiler family
- GCC / g++
- [ x] Clang / clang++
- MSVC (Visual Studio)
- Intel / oneAPI
- Other (specify below)
Exact compiler version:
Apple clang version 16.0.0 (clang-1600.0.26.4)
Standard library
- libstdc++
- libc++
- MSVC STL
- Other (specify below)
Operating system
- Linux
- [ x] macOS
- Windows
- Other (specify below)
Kind of component affected
- Graph data structure (e.g.
adjacency_list,adjacency_matrix) - [ x] Algorithm (e.g.
dijkstra_shortest_paths,breadth_first_search) - Property map
- I/O or file-format reader (e.g.
read_graphml,read_graphviz) - Visitor / event hooks
- Other (specify below)
Exact name of the affected component:
sequential_vertex_coloring
Steps to reproduce
(i) create a filtered graph (g) that reduces the number of vertices
(ii) call sequential_vertex_coloring(g,color_map), i.e., without an order property map
See the attached reproducer, which colors both the original and filtered graphs to demonstrate the problem only with the latter.
Expected behavior
The algorithm should complete.
Actual behavior
Segmentation fault, i.e., signal 11.
Are you willing to help?
- I'd like to submit a fix as a pull request.
- I can help diagnose or test a candidate fix.
- [ x] I'm only reporting the issue.
I am happy to help test as needed, but this report should be entirely self-contained with a reproducer and a patch (see below).
- Dominant language
- C++
- Stars
- 397
- Forks
- 246
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 31
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/graph
-
beginner friendly
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
boostorg/graph#593 · 39 comments ·
Maintainers usually reply within 1 day
-
algorithm beginner friendly priority: high
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
boostorg/graph#231 · 2 comments ·
Maintainers usually reply within 1 day
-
algorithm
Difficulty 3/5 1-2 days Newbie friendliness 68/100
boostorg/graph#599 · 3 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
Maintainers usually reply within 1 day
-
Implementing personalized PageRank for graph node scoring.Possibly taken @Becheler claimed this 136 days ago. Openalgorithm
boostorg/graph#493 · 22 comments · 1 reaction · 2 assignees ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
EsotericSoftware/spine-runtimes#3186 ·
-
An empty line splits a signature where an ordinary comment is right above an argument's HaddockOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
mrkkrp/tilia#213 · 1 comment ·
Maintainers usually reply within 1 day
-
Round video messages start gray and blocky with libx264: encoder is configured for 1,000,000 fpsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
telegramdesktop/tdesktop#31422 ·
Maintainers usually reply within 9 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
duckdb/duckdb-quack#299 ·
Maintainers usually reply within 1 day