Skip to content

Fix memory corruption caused by GlyphExtVertexSerializer#760

Merged
dima-dencep merged 1 commit intoAsek3:1.20.1-newfrom
embeddedt:glyphext-crash-fix
Jan 28, 2025
Merged

Fix memory corruption caused by GlyphExtVertexSerializer#760
dima-dencep merged 1 commit intoAsek3:1.20.1-newfrom
embeddedt:glyphext-crash-fix

Conversation

@embeddedt
Copy link

The Iris 1.7.x implementation of GlyphExtVertexSerializer performs out-of-bounds memory reads & writes when extending the vertex data. This leads to unpredictable behavior including consistent JVM native crashes on some platforms.

There are several problems in the original code:

  • The quad view is set up using the extended format's stride, but reads from the source buffer which contains data aligned for the non-extended format.
  • The quad view is set up using a pointer that points to the end of the last vertex, but the logic inside expects the pointer to point at the start of the last vertex.

While investigating this problem, I determined the bug was quietly fixed upstream in this Iris commit for 1.8.0-beta.1. The fix does not appear to have been backported to any 1.7.x releases; as such, previous releases of Iris for Fabric are likely also affected.

I have confirmed, through testing, that a certain class of JVM crashes appear to be resolved by this change.

@dima-dencep dima-dencep merged commit a0b9d31 into Asek3:1.20.1-new Jan 28, 2025
1 check passed
@dima-dencep
Copy link
Collaborator

Thanks ❤️

@embeddedt embeddedt deleted the glyphext-crash-fix branch January 28, 2025 20:30
KostromDan pushed a commit to KostromDan/Mekalus that referenced this pull request Apr 22, 2025
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.

2 participants