Skip to content

parser: Avoid reading after the end of shunting yard stack#209

Open
sin-ack wants to merge 1 commit intographitemaster:mainfrom
sin-ack:parser-read-before-erase
Open

parser: Avoid reading after the end of shunting yard stack#209
sin-ack wants to merge 1 commit intographitemaster:mainfrom
sin-ack:parser-read-before-erase

Conversation

@sin-ack
Copy link
Copy Markdown

@sin-ack sin-ack commented Oct 27, 2024

We would previously do this:

  • Erase items from the buffer
  • Read the items we just erased

This is a mistake because the vector might have resized itself after the erase call. This would cause assertion errors with the GNU STL. We now instead read the offsets we want to read from before performing the erase.

There may be other occurrences of this, but I've only hit these cases when compiling Xonotic.

We would previously do this:

- Erase items from the buffer
- Read the items we just erased

This is a mistake because the vector might have resized itself after the
erase call. This would cause assertion errors with the GNU STL. We now
instead read the offsets we want to read from before performing the
erase.

There may be other occurrences of this, but I've only hit these cases
when compiling Xonotic.
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.

1 participant