Skip to content

Fix LinearContainerFactor::rekey() segfault without linearization point#2467

Merged
dellaert merged 1 commit intoborglab:developfrom
jashshah999:fix/linear-container-factor-rekey
Mar 13, 2026
Merged

Fix LinearContainerFactor::rekey() segfault without linearization point#2467
dellaert merged 1 commit intoborglab:developfrom
jashshah999:fix/linear-container-factor-rekey

Conversation

@jashshah999
Copy link
Copy Markdown
Contributor

Description

LinearContainerFactor::rekey() segfaults when called on a factor constructed without a linearization point. Both overloads unconditionally dereference the optional linearizationPoint_ member.

Fix

Guard the linearization point rekeying with a has_value() check in both rekey overloads, so the underlying linear factor keys are still remapped correctly even when no linearization point exists.

Test

Added RekeyWithoutLinearizationPoint test that exercises both rekey overloads on a LinearContainerFactor constructed from a HessianFactor without a linearization point.

Fixes #1904

… point

LinearContainerFactor::rekey() would segfault when called on a factor
constructed without a linearization point, since it unconditionally
dereferenced the optional linearizationPoint_ member. Wrap the
linearization point rekeying in a has_value() check for both overloads.

Fixes borglab#1904
Copy link
Copy Markdown
Member

@dellaert dellaert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@dellaert dellaert merged commit 4d5af0d into borglab:develop Mar 13, 2026
34 of 36 checks passed
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 this pull request may close these issues.

LinearFactorContainer rekey()

2 participants