OSGeo / grass

GRASS GIS - free and open-source geospatial processing engine
https://grass.osgeo.org
Other
855 stars 310 forks source link

lib/vector/Vlib: Fix out-of-scope memory access #4667

Closed ymdatta closed 3 days ago

ymdatta commented 2 weeks ago

A local array was used to store column name and column type for each column, and a pointer to this local array was stored and accessed outside its scope, which can cause undefined behavior.

To avoid this, use memory from heap to store this information so that it's accessible outside where its defined and free this memory at the end to avoid memory leaks.

This issue was found using cppcheck static analysis tool.