[1/2] shader_runner: Fix integer vbo attribute parsing on 32-bit systems.

Submitted by Kenneth Graunke on June 6, 2016, 8:59 p.m.

Details

Message ID 20160606205959.20453-1-kenneth@whitecape.org
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Kenneth Graunke June 6, 2016, 8:59 p.m.
The new ARB_vertex_attrib_64bit tests specify integer vertex attributes
with hex values, such as 0xc21620c5.  As an integer value, this is
beyond LONG_MAX on 32-bit systems.  The intent is to parse it as an
unsigned hex value and bitcast it.

However, we still need to handle parsing values with negative signs.

Using strtoll and truncating should work.  It breaks the errno-based
range validation, but we can still at least try to reject some cases.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
---
 tests/util/piglit-vbo.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/tests/util/piglit-vbo.cpp b/tests/util/piglit-vbo.cpp
index 1bdd9da..fd7e72a 100644
--- a/tests/util/piglit-vbo.cpp
+++ b/tests/util/piglit-vbo.cpp
@@ -387,7 +387,7 @@  vertex_attrib_description::parse_datum(const char **text, void *data) const
 		break;
 	}
 	case GL_INT: {
-		long value = strtol(*text, &endptr, 0);
+		long value = (long) strtoll(*text, &endptr, 0);
 		if (errno == ERANGE) {
 			printf("Could not parse as signed integer\n");
 			return false;