shithub: tinygl

Download patch

ref: 2c7759454b08e343c23d64b361f79550166dab9d
parent: a256a597ea623ff8972fe332e7c9f352e9f36c20
author: Yuan <zodf0055980@gmail.com>
date: Wed Jun 29 05:27:41 EDT 2022

Fix global buffer overflow at glMaterialfv

--- a/src/api.c
+++ b/src/api.c
@@ -378,7 +378,7 @@
 	n = 4;  /* This appears to be a hack... to avoid a jump instruction? What the hell?*/
 	if (type == GL_SHININESS)
 		n = 1;
-	for (i = 0; i < 4; i++)
+	for (i = 0; i < n; i++)
 		p[3 + i].f = v[i];
 	for (i = n; i < 4; i++)
 		p[3 + i].f = 0;