It seems like when parsing a value like 0xc0d1cbdd371d381f with strtoll,
it returns 0x7fffffffffffffff, presumably because it goes out of bounds.
I guess this issue didn't happen with float, but seems safe to fix it as
well.

Signed-off-by: Ilia Mirkin <imir...@alum.mit.edu>
---
 tests/shaders/shader_runner.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 8da0984..baccd35 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -1143,11 +1143,11 @@ get_floats(const char *line, float *f, unsigned count)
 
                if (strncmp(line, "0x", 2) == 0) {
                        union {
-                               int32_t i;
+                               uint32_t u;
                                float f;
                        } x;
 
-                       x.i = strtol(line, (char **) &line, 16);
+                       x.u = strtoul(line, (char **) &line, 16);
                        f[i] = x.f;
                } else {
                        f[i] = strtod_inf(line, (char **) &line);
@@ -1165,11 +1165,11 @@ get_doubles(const char *line, double *d, unsigned count)
 
                if (strncmp(line, "0x", 2) == 0) {
                        union {
-                               int64_t i64;
+                               uint64_t u64;
                                double d;
                        } x;
 
-                       x.i64 = strtoll(line, (char **) &line, 16);
+                       x.u64 = strtoull(line, (char **) &line, 16);
                        d[i] = x.d;
                } else {
                        d[i] = strtod_inf(line, (char **) &line);
-- 
2.0.5

_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to