Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation Fault in FundamentalMatrixSevenPointSolver #11

Open
fkluger opened this issue Aug 15, 2023 · 0 comments
Open

Segmentation Fault in FundamentalMatrixSevenPointSolver #11

fkluger opened this issue Aug 15, 2023 · 0 comments

Comments

@fkluger
Copy link

fkluger commented Aug 15, 2023

Hi,

I am running some experiments with F-Matrix estimation and am occasionally encountering segmentation faults.

GDB gave me this:

#0  gcransac::estimator::solver::FundamentalMatrixSevenPointSolver::estimateModel (this=this@entry=0x7fffffff9da8, data_=..., sample_=sample_@entry=0x0, sample_number_=7, models_=..., weights_=weights_@entry=0x0)
    at /home/kluger/projects/remote/progressive-x/graph-cut-ransac/src/pygcransac/include/estimators/solver_fundamental_matrix_seven_point.h:103
103                                             const int sample_idx = sample_[i];

(gdb) p sample_
$7 = (const size_t *) 0x0

So sample_ appears to be nullptr and FundamentalMatrixSevenPointSolver::estimateModel does not handle this.

I noticed this case is handled in FundamentalMatrixBundleAdjustmentSolver::estimateModel:

if (sample_ == nullptr)
	sample_number_ = data_.rows;

If sample_number_ is greater than seven, the Eight-Point-Solver is used instead.

However, in this particular case:

(gdb) p data_.rows
$8 = 7

So the Seven-Point-Solver is still called because sample_number_ = 7, which then segfaults because sample_ = nullptr.

I will try adding another check to FundamentalMatrixSevenPointSolver::estimateModel for sample_ == nullptr to avoid the segfault, but I don't know if this is the correct way to fix this bug.

Best wishes,
Florian

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

No branches or pull requests

1 participant