opengles emulator: fix GLESv2 shader source packing
fix segfault when calling glShaderSouce with empty shader string, length=NULL and count>0 Change-Id: I4c9738d7726fbce22d1e84420faa2bfd772943c5
This commit is contained in:
committed by
David 'Digit' Turner
parent
9e883e8b5f
commit
0a190be2bc
@@ -373,7 +373,8 @@ void glUtilsPackStrings(char *ptr, char **strings, GLint *length, GLsizei coun
|
||||
char *p = ptr;
|
||||
*p = '\0';
|
||||
for (int i = 0; i < count; i++) {
|
||||
int l;
|
||||
int l=0;
|
||||
if (strings[i]!=NULL) {
|
||||
if (length == NULL || length[i] < 0) {
|
||||
l = strlen(strings[i]);
|
||||
strcat(p, strings[i]);
|
||||
@@ -381,6 +382,7 @@ void glUtilsPackStrings(char *ptr, char **strings, GLint *length, GLsizei coun
|
||||
l = length[i];
|
||||
strncat(p, strings[i], l);
|
||||
}
|
||||
}
|
||||
p += l;
|
||||
}
|
||||
}
|
||||
@@ -392,7 +394,7 @@ int glUtilsCalcShaderSourceLen( char **strings, GLint *length, GLsizei count)
|
||||
for (int i = 0; i < count; i++) {
|
||||
int l;
|
||||
if (length == NULL || length[i] < 0) {
|
||||
l = strlen(strings[i]);
|
||||
l = strings[i]!=NULL ? strlen(strings[i]) : 0;
|
||||
} else {
|
||||
l = length[i];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user