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

Fix destructor dereferencing #53

Merged
merged 1 commit into from
Apr 29, 2023
Merged

Fix destructor dereferencing #53

merged 1 commit into from
Apr 29, 2023

Conversation

dm9pZCAq
Copy link
Contributor

  • fix segfault caused by passing destructed value to cvector_free with cvector_destructor
  • add unit test for dereferencing vector in cvector_destructor

So, the problem was caused by code resembling the following:

cvector_free(*vec_ptr);

This code expands to:

&*vec_ptr[i]

This leads to an erroneous memory access and results in a segmentation fault.

* fix segfault caused by passing destructed value to `cvector_free` with
  `cvector_destructor`
* add unit test for dereferencing vector in cvector_destructor
@eteran eteran merged commit 61ccddf into eteran:master Apr 29, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants