Fix linked list iteration when displaying errors #13936
Merged
+3
−1
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.
When a script has problem with the magic comment encoding, we only display that error. However, if there are other syntax errors in the file, the error linked list could contain multiple items. This lead to an inconsistency in the "size" field of the linked list, and the actual items in the linked list. In other words, the linked list had more than one item, but the size field was one.
The error display routine would only allocate
size
items, but iterating the linked list would overrun the array. This commit changes the iterator to compare the current node to the "finish" node in the linked list, no longer assuming the linked list ends with NULL.[Bug #21461]