Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • openfoam openfoam
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 395
    • Issues 395
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 11
    • Merge requests 11
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Development
  • openfoamopenfoam
  • Issues
  • #1753

Closed
Open
Created Jun 29, 2020 by Mattijs Janssens@MattijsMaintainer

TableBase copy constructor does not clear out interpolationWeights / no clone() functionality

Summary

TableBase might allocate an interpolator (interpolationWeights). interpolationWeights holds a reference to the set of input samples. When copying the TableBase it copies these interpolationWeights which now has a reference to some outside data. If this has gone out of scope the interpolator will access invalid data.

Steps to reproduce

Not trivial. Use copy construct on Table (or TableFile). Could not replicate it on e.g. damBreakWithObstacle (topo changes) with U set to uniformFixedValue with a table.

Example case

What is the current bug behaviour?

What is the expected correct behavior?

Relevant logs and/or images

Environment information

  • OpenFOAM version : v2006
  • Operating system : any

Possible fixes

Reset autoPtrs in copy constructor. This will trigger rebuilding the interpolator

template<class Type>
Foam::Function1Types::TableBase<Type>::TableBase(const TableBase<Type>& tbl)
:
    Function1<Type>(tbl),
    name_(tbl.name_),
    bounding_(tbl.bounding_),
    interpolationScheme_(tbl.interpolationScheme_),
    table_(tbl.table_),
    tableSamplesPtr_(nullptr),
    interpolatorPtr_(nullptr)
{}
Edited Jun 29, 2020 by Mattijs Janssens
Assignee
Assign to
Time tracking