Merge "Add negative tests for per-patch output aggregate types."
diff --git a/executor/xeXMLWriter.cpp b/executor/xeXMLWriter.cpp
index 387c8c9..feaa2c9 100644
--- a/executor/xeXMLWriter.cpp
+++ b/executor/xeXMLWriter.cpp
@@ -41,6 +41,38 @@
case '&': return "&";
case '\'': return "'";
case '"': return """;
+
+ // Non-printable characters.
+ case 0: return "<NUL>";
+ case 1: return "<SOH>";
+ case 2: return "<STX>";
+ case 3: return "<ETX>";
+ case 4: return "<EOT>";
+ case 5: return "<ENQ>";
+ case 6: return "<ACK>";
+ case 7: return "<BEL>";
+ case 8: return "<BS>";
+ case 11: return "<VT>";
+ case 12: return "<FF>";
+ case 14: return "<SO>";
+ case 15: return "<SI>";
+ case 16: return "<DLE>";
+ case 17: return "<DC1>";
+ case 18: return "<DC2>";
+ case 19: return "<DC3>";
+ case 20: return "<DC4>";
+ case 21: return "<NAK>";
+ case 22: return "<SYN>";
+ case 23: return "<ETB>";
+ case 24: return "<CAN>";
+ case 25: return "<EM>";
+ case 26: return "<SUB>";
+ case 27: return "<ESC>";
+ case 28: return "<FS>";
+ case 29: return "<GS>";
+ case 30: return "<RS>";
+ case 31: return "<US>";
+
default: return DE_NULL;
}
}
diff --git a/framework/opengl/gluShaderProgram.cpp b/framework/opengl/gluShaderProgram.cpp
index 3070bc8..7c273d8 100644
--- a/framework/opengl/gluShaderProgram.cpp
+++ b/framework/opengl/gluShaderProgram.cpp
@@ -89,23 +89,45 @@
GLU_EXPECT_NO_ERROR(m_gl.getError(), "glCompileShader()");
- // Query status & log.
+ // Query status
{
- int compileStatus = 0;
- int infoLogLen = 0;
- int unusedLen;
+ int compileStatus = 0;
- m_gl.getShaderiv(m_shader, GL_COMPILE_STATUS, &compileStatus);
- m_gl.getShaderiv(m_shader, GL_INFO_LOG_LENGTH, &infoLogLen);
+ m_gl.getShaderiv(m_shader, GL_COMPILE_STATUS, &compileStatus);
GLU_EXPECT_NO_ERROR(m_gl.getError(), "glGetShaderiv()");
m_info.compileOk = compileStatus != GL_FALSE;
+ }
+
+ // Query log
+ {
+ int infoLogLen = 0;
+ int unusedLen;
+
+ m_gl.getShaderiv(m_shader, GL_INFO_LOG_LENGTH, &infoLogLen);
+ GLU_EXPECT_NO_ERROR(m_gl.getError(), "glGetShaderiv()");
if (infoLogLen > 0)
{
- std::vector<char> infoLog(infoLogLen);
- m_gl.getShaderInfoLog(m_shader, (int)infoLog.size(), &unusedLen, &infoLog[0]);
- m_info.infoLog = std::string(&infoLog[0], infoLogLen);
+ // The INFO_LOG_LENGTH query and the buffer query implementations have
+ // very commonly off-by-one errors. Try to work around these issues.
+
+ // add tolerance for off-by-one in log length, buffer write, and for terminator
+ std::vector<char> infoLog(infoLogLen + 3, '\0');
+
+ // claim buf size is one smaller to protect from off-by-one writing over buffer bounds
+ m_gl.getShaderInfoLog(m_shader, (int)infoLog.size() - 1, &unusedLen, &infoLog[0]);
+
+ if (infoLog[(int)(infoLog.size()) - 1] != '\0')
+ {
+ // return whole buffer if null terminator was overwritten
+ m_info.infoLog = std::string(&infoLog[0], infoLog.size());
+ }
+ else
+ {
+ // read as C string. infoLog is guaranteed to be 0-terminated
+ m_info.infoLog = std::string(&infoLog[0]);
+ }
}
}
}
diff --git a/modules/gles31/functional/es31fNegativeShaderApiTests.cpp b/modules/gles31/functional/es31fNegativeShaderApiTests.cpp
index e0d5a6e..a35b941 100644
--- a/modules/gles31/functional/es31fNegativeShaderApiTests.cpp
+++ b/modules/gles31/functional/es31fNegativeShaderApiTests.cpp
@@ -555,8 +555,8 @@
void get_sampler_parameterfv (NegativeTestContext& ctx)
{
- float params;
- GLuint sampler = 0;
+ float params = 0.0f;
+ GLuint sampler = 0;
ctx.glGenSamplers (1, &sampler);
ctx.beginSection("GL_INVALID_OPERATION is generated if sampler is not the name of a sampler object returned from a previous call to ctx.glGenSamplers.");
diff --git a/modules/gles31/functional/es31fNegativeStateApiTests.cpp b/modules/gles31/functional/es31fNegativeStateApiTests.cpp
index 53a42b9..8f07c11 100644
--- a/modules/gles31/functional/es31fNegativeStateApiTests.cpp
+++ b/modules/gles31/functional/es31fNegativeStateApiTests.cpp
@@ -335,10 +335,10 @@
void get_program_info_log (NegativeTestContext& ctx)
{
- GLuint program = ctx.glCreateProgram();
- GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
- GLsizei length[1];
- char infoLog[1];
+ GLuint program = ctx.glCreateProgram();
+ GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
+ GLsizei length[1] = { 0 };
+ char infoLog[1] = { 'x' };
ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
ctx.glGetProgramInfoLog (-1, 1, &length[0], &infoLog[0]);