Fix uninitialised value in vpMeLine::getExtremities() when moving-edges list is empty - #1993
Merged
Merged
Conversation
… on empty moving-edges list. Closes: lagadic#1992 vpMeLine::getExtremities() called m_meList.front()/back() without checking whether m_meList was empty. suppressPoints() can empty the list entirely (line leaving the image, strong occlusion, fast motion), and front()/back() on an empty std::list is undefined behaviour: it reads the list's sentinel node as a constructed vpMeSite, i.e. uninitialised memory. Changes: - vpMeLine::getExtremities() and vpMeLine::setExtremities() now return bool, returning false early when m_meList is empty instead of dereferencing front()/back(). - vpMeLine::getExtremities() marked as VP_NODISCARD so callers can't silently ignore the failure case. - Updated all call sites to check the return value and bail out gracefully (return 0 / early return) when the list is empty: - vpMeLine::seekExtremities() - vpMeLine::plugHoles() - vpMbtMeLine::seekExtremities()
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1993 +/- ##
==========================================
- Coverage 48.75% 48.73% -0.03%
==========================================
Files 532 532
Lines 69416 69425 +9
Branches 32440 32442 +2
==========================================
- Hits 33847 33833 -14
- Misses 31444 31450 +6
- Partials 4125 4142 +17 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.