Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Nov 23, 2024

Conversation

ymdatta
Copy link
Contributor

@ymdatta ymdatta commented Nov 7, 2024

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.

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 was found using cppcheck tool.

Signed-off-by: Mohan Yelugoti <[email protected]>
@github-actions github-actions bot added vector Related to vector data processing C Related code is in C libraries labels Nov 7, 2024
@echoix echoix merged commit 6acffcb into OSGeo:main Nov 23, 2024
26 checks passed
@github-actions github-actions bot added this to the 8.5.0 milestone Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C Related code is in C libraries vector Related to vector data processing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants