Skip to content

Fix dijkstraVia bad alloc on 4.0.2 - #3123

Merged
cvvergara merged 6 commits into
pgRouting:mainfrom
cvvergara:fix-dijkstraVia-bad-alloc-main
Jul 28, 2026
Merged

Fix dijkstraVia bad alloc on 4.0.2#3123
cvvergara merged 6 commits into
pgRouting:mainfrom
cvvergara:fix-dijkstraVia-bad-alloc-main

Conversation

@cvvergara

Copy link
Copy Markdown
Member

Fixes #3110: pgr_dijkstraVia crash when via vertex not in graph
pgr_dijkstraVia threw a bad_alloc error when a via vertex did not exist in the graph. The fix adds an empty-path check before accessing paths.front()
When a via vertex is missing, the function now returns an empty result set instead of crashing.

File changes summary:

  • CMakeLists.txt: Version bump to 4.0.2
  • include/dijkstra/dijkstra.hpp: Return empty Path when paths is empty
  • pgtap/dijkstra/dijkstraVia/edge_cases/issue-3110.pg: New test covering via vertices that exist, don't exist, and are missing
    between valid vertices
    • Back-port note: The min_version('4.0.1') guard in the test skips on older versions where the bug still exists.
  • NEWS.md, doc/src/release_notes.rst: Release notes for the fix

@pgRouting/admins

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 8d97f756-dae8-4886-b927-7b370c101a32

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cvvergara
cvvergara requested review from iosefa, robe2 and sanak July 27, 2026 19:15
@cvvergara cvvergara changed the title Fix dijkstraVia bad alloc main Fix dijkstraVia bad alloc on 4.0.2 Jul 27, 2026
@cvvergara
cvvergara merged commit 4837e48 into pgRouting:main Jul 28, 2026
64 checks passed
@cvvergara
cvvergara deleted the fix-dijkstraVia-bad-alloc-main branch July 28, 2026 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants