commit | 865952821fc2af7afd35bc1dbb3ca2f2806ea620 | [log] [tgz] |
---|---|---|
author | Sameer Agarwal <sameeragarwal@google.com> | Fri Apr 20 11:02:48 2018 -0700 |
committer | Sameer Agarwal <sameeragarwal@google.com> | Fri Apr 20 11:02:48 2018 -0700 |
tree | 6c70e445ecca767aa9096c2afc28f2eb6e93a4b3 | |
parent | 4556eb98104c3e2f1afed2fc507ed19c6162cff5 [diff] |
Fix a use after free bug in the tests. The way the SystemTest fixture works is that it takes a "FooProblem" object as a type, which contains a ceres::Problem and a ceres::Solver::Options object. The Options object also contains a linear_solver_ordering which contains double* which refer to memory that is allocated when a problem object is created. So it is important that the lifetime of the ceres::Problem object and the ceres::Solver::Options object be tied together. But we were violating this by creating a FooProblem object on the stack, grabbing its Options struct and passing it to the SystemTest fixture, which would then create another instance of FooProblem, grab its Problem object and copy the modified options struct into it. In the case where a user provided ordering was being used, this ordering would now be referring to memory allocated by the first FooProblem object, which would cause Ceres's internal ApplyOrdering function to fail. The fix is ofcourse to Problem and Options object that are born together. Change-Id: I07c377a9d5fcabbb6c7ca8aa3460206ce045ffa9
Ceres Solver is an open source C++ library for modeling and solving large, complicated optimization problems. It is a feature rich, mature and performant library which has been used in production at Google since 2010. Ceres Solver can solve two kinds of problems.
Please see ceres-solver.org for more information.
Ceres development happens on Gerrit, including both repository hosting and code reviews. The GitHub Repository is a continuously updated mirror which is primarily meant for issue tracking. Please see our Contributing to Ceres Guide for more details.
The upstream Gerrit repository is
https://ceres-solver.googlesource.com/ceres-solver