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

dynablock: do not access value when foreach on marks #172

Merged
merged 1 commit into from Aug 5, 2020

Conversation

Icenowy
Copy link
Contributor

@Icenowy Icenowy commented Aug 5, 2020

Accessing the value of a kh_set (which has no values set) is an
undefined behavior, which may make monsters to appear.

Add a kh_foreach_key macro that do not touch values at all, and use it
when ennuerating marks in dynablock, to prevent SIGSEGV of accessing
non-existent values.

Signed-off-by: Icenowy Zheng icenowy@aosc.io

Accessing the value of a kh_set (which has no values set) is an
undefined behavior, which may make monsters to appear.

Add a kh_foreach_key macro that do not touch values at all, and use it
when ennuerating marks in dynablock, to prevent SIGSEGV of accessing
non-existent values.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
@ptitSeb ptitSeb merged commit 79051e0 into ptitSeb:master Aug 5, 2020
@ptitSeb
Copy link
Owner

ptitSeb commented Aug 5, 2020

Nice one! (still miss the test of db->parent->blocks).

@Icenowy
Copy link
Contributor Author

Icenowy commented Aug 5, 2020

oh sorry, I messed code in #171 into this PR.

@ptitSeb
Copy link
Owner

ptitSeb commented Aug 5, 2020

That's fine, If you can now just do a small PR with the test (or I'll do it later).

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