MolSSI-MDI / MDI_Library

A library that enables code interoperability via the MolSSI Driver Interface.
BSD 3-Clause "New" or "Revised" License
31 stars 10 forks source link

Passing pointer to out of scope local variable #158

Closed akohlmey closed 5 months ago

akohlmey commented 7 months ago

https://github.com/MolSSI-MDI/MDI_Library/blob/54a477c3ab067384916059b5cc8b881b24babeff/MDI_Library/mdi.c#L2126

This piece of code is problematic since it creates a pointer to a local variable (allocated on the stack) and passes it to a function after the stack frame has been released. It can only work by chance. Here is the info from Coverity scan static code analysis.

mpi-comm-convert

taylor-a-barnes commented 6 months ago

Thanks very much for pointing this out Axel. This should be resolved by commit 6760fd2.

taylor-a-barnes commented 5 months ago

Thanks again! The v1.4.26 release includes this fix.