Skip to content
  • Laurent Rineau's avatar
    Fix ASAN error use-after-free in vtkSEPReader · 8a7f62ed
    Laurent Rineau authored
    The previous implementation os vtkSEPReader had a use-after-free.
    
    The function `vtkSEPReader::ReplaceFileName(..)` started with:
    
    ```c++
      delete[] this->FileName;
    ```
    
    And that means that the string pointed by `FileName` was
    destroyed. Even if the value of `FileName` was stored in the local
    variable `fileName`, in `vtkSEPReader::RequestData`, the string
    pointed by it was destroyed!
    
    The patch of this commit is a lot simpler: both the string pointed by
    `FileName` and the one that will replace it already exist in memory,
    and will not be modified during the run of `RequestData`. So we can
    just swap the pointers, without any need to memory
    allocation/deallocation to copy the strings.
    8a7f62ed