sscanf returns EOF if not all values are scanned. This can be interpreted as 'true' in these cases leading to the clip plane command being incorrectly requested.
Signed-off-by: Jordan Justen <[email protected]> --- tests/shaders/shader_runner.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c index 38a0fcf..7e5b7b4 100644 --- a/tests/shaders/shader_runner.c +++ b/tests/shaders/shader_runner.c @@ -2339,7 +2339,7 @@ piglit_display(void) glClear(clear_bits); } else if (sscanf(line, "clip plane %d %lf %lf %lf %lf", - &x, &d[0], &d[1], &d[2], &d[3])) { + &x, &d[0], &d[1], &d[2], &d[3]) == 5) { if (x < 0 || x >= gl_max_clip_planes) { printf("clip plane id %d out of range\n", x); piglit_report_result(PIGLIT_FAIL); @@ -2381,7 +2381,7 @@ piglit_display(void) &primcount, c + 0, c + 1, c + 2, c + 3); draw_instanced_rect(primcount, c[0], c[1], c[2], c[3]); - } else if (sscanf(line, "draw arrays %31s %d %d", s, &x, &y)) { + } else if (sscanf(line, "draw arrays %31s %d %d", s, &x, &y) == 3) { GLenum mode = decode_drawing_mode(s); int first = x; size_t count = (size_t) y; -- 2.1.4 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
