Skip to content

Commit

Permalink
Merge pull request #1496 from fspindle/fix_vpArray_resize
Browse files Browse the repository at this point in the history
Fix vpArray resize() that has a potential issue in memory management when dsize = 0
  • Loading branch information
fspindle authored Nov 3, 2024
2 parents 52a429d + 520efed commit d8ae587
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ ViSP 3.x.x (Version in development)
. [#1341] SVD computation fails with Lapack when m < n
. [#1370] encountered compilation errors while building the ViSP library
. [#1424] Unable to detect Yarp 3.9.0
. [#1485] Build issue around nlohmann_json usage with VTK 9.2.0 or more recent version used as an embedded
3rdparty by PCL
. [#1494] Memory management issue in vpArray2D::resize()
----------------------------------------------
ViSP 3.6.0 (released September 22, 2023)
- Contributors:
Expand Down
9 changes: 4 additions & 5 deletions example/math/quadprog_eq.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/****************************************************************************
*
/*
* ViSP, open source Visual Servoing Platform software.
* Copyright (C) 2005 - 2023 by Inria. All rights reserved.
* Copyright (C) 2005 - 2024 by Inria. All rights reserved.
*
* This software is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -30,8 +29,8 @@
*
* Description:
* Example of sequential calls to QP solver with constant equality constraint
*
*****************************************************************************/
*/

/*!
\file quadprog_eq.cpp
Expand Down
5 changes: 4 additions & 1 deletion modules/core/include/visp3/core/vpArray2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,10 @@ template <class Type> class vpArray2D

// Recopy of this->data array values or nullify
if (flagNullify) {
memset(this->data, 0, static_cast<size_t>(this->dsize) * sizeof(Type));
// If dsize = 0 nothing to do
if ((nullptr != this->data) && (0 != this->dsize)) {
memset(this->data, 0, static_cast<size_t>(this->dsize) * sizeof(Type));
}
}
else if (recopyNeeded && (this->rowPtrs != nullptr)) {
// Recopy...
Expand Down
3 changes: 1 addition & 2 deletions modules/core/src/math/transformation/vpHomogeneousMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
*
* Description:
* Homogeneous matrix.
*
*****************************************************************************/
*/

/*!
\file vpHomogeneousMatrix.cpp
Expand Down

0 comments on commit d8ae587

Please sign in to comment.