parse: don't remove datalist items during iteration#450
Merged
daniloegea merged 1 commit intocanonical:mainfrom Apr 3, 2024
Merged
parse: don't remove datalist items during iteration#450daniloegea merged 1 commit intocanonical:mainfrom
daniloegea merged 1 commit intocanonical:mainfrom
Conversation
The glib documentation says that it should be safe to remove items from inside the function called by g_datalist_foreach but I've found some crashes related to it where the last element was returning NULL. This is one of the instances that causes the crash: passthrough: Utf14: sit cupidatat aliquip proident ut reprehenderit6e2: 16408719.105799645 connection.type: ullamco officia Message from glib: GLib-CRITICAL **: 10:16:09.406: g_strsplit: assertion 'string != NULL' failed With this change the bad keys will be stored in an GArray and removed from the datalist outside the foreach.
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The glib documentation says that it should be safe to remove items from inside the function called by g_datalist_foreach but I've found some crashes related to it where the last element was returning NULL.
This is one of the instances that causes the crash:
Message from glib:
With this change the bad keys will be stored in an GArray and removed from the datalist outside the foreach.
Description
I was testing my https://github.com/daniloegea/netplan-fuzz and stumbled upon this issue.
Error from glib:
Note this case, the last warning mentions a key called
GParamGTypebut it is not part of the keys. That means the pointer it's working with at this moment is not what we expect due to inconsistencies in the data structure.Full YAML that found the problem.
Checklist
make checksuccessfully.make check-coverage).