commit | bbe790e0f3ba9e9565862067198d2760ab669ec8 | [log] [tgz] |
---|---|---|
author | Sameer Agarwal <sameeragarwal@google.com> | Sat Jul 07 15:14:48 2018 -0700 |
committer | Sameer Agarwal <sameeragarwal@google.com> | Tue Jul 10 06:17:34 2018 +0000 |
tree | a6325af5094d9d638420775960dc2a0c1f07e4b2 | |
parent | 2c1e595b775f6c23ec985ac20976f81dbed327e5 [diff] |
Fix three out of bounds errors in CompressedRowSparseMatrix. All three errors are of the form where, the vector storing the columns array for a CompressedRowSparseMatrix is being accessed out of bounds. But in each case, the access is innocuous because there are other tests which prevent it from being used. However, if one compiles with debug mode on, the bounds checking in the underlying std::vector triggers an error. More details: 1. FromTripletSparseMatrix tried accessing the col vector of a matrix with zero rows, but the following code was a no-op because there was nothing to copy. Adding an early return which deals with this case fixes this. 2. RightMultiply and SquaredColumnNorm had the following loop while (r > cols_[idx] && idx < idx_end) { ++idx; } where cols_ was being accessed out of bounds, before idx < idx_end was being checked. Swapping the order of the comparisons fixes this error. @richmattes reported this error. https://github.com/ceres-solver/ceres-solver/issues/383 Change-Id: I2dbc90ef24ecaffc6f46f1622339d6053b43db45
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.