Skip to content

Fix uninitialised value in vpMeLine::getExtremities() when moving-edges list is empty - #1993

Merged
fspindle merged 4 commits into
lagadic:masterfrom
fspindle:fix_valgrind_vpMeLine
Jul 22, 2026
Merged

Fix uninitialised value in vpMeLine::getExtremities() when moving-edges list is empty#1993
fspindle merged 4 commits into
lagadic:masterfrom
fspindle:fix_valgrind_vpMeLine

Conversation

@fspindle

Copy link
Copy Markdown
Contributor

No description provided.

fspindle added 4 commits July 22, 2026 10:08
… 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

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 57.14286% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.73%. Comparing base (482e293) to head (18a1c36).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
modules/tracker/me/src/moving-edges/vpMeLine.cpp 45.45% 3 Missing and 3 partials ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fspindle
fspindle merged commit 09f77c1 into lagadic:master Jul 22, 2026
77 of 82 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.

1 participant