Mesa (master): st/mesa: improve error messages and fix security warning

Nicolai Hähnle nh at kemper.freedesktop.org
Thu Mar 30 09:25:30 UTC 2017


Module: Mesa
Branch: master
Commit: 257ee3f7ef21dfbd65a3dac423a986b926ca0d18
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=257ee3f7ef21dfbd65a3dac423a986b926ca0d18

Author: Nicolai Hähnle <nicolai.haehnle at amd.com>
Date:   Thu Mar 30 11:22:23 2017 +0200

st/mesa: improve error messages and fix security warning

Debian, Ubuntu set default build flag: -Werror=format-security

  CC       state_tracker/st_cb_texturebarrier.lo
state_tracker/st_cb_eglimage.c: In function ‘st_egl_image_get_surface’:
state_tracker/st_cb_eglimage.c:64:7: error: format not a string literal and no format arguments [-Werror=format-security]
       _mesa_error(ctx, GL_INVALID_VALUE, error);
       ^~~~~~~~~~~
state_tracker/st_cb_eglimage.c:71:7: error: format not a string literal and no format arguments [-Werror=format-security]
       _mesa_error(ctx, GL_INVALID_OPERATION, error);
       ^~~~~~~~~~~

Reported-by: Krzysztof Kolasa <kkolasa at winsoft.pl>
Fixes: 83e9de25f325 ("st/mesa: EGLImageTarget* error handling")

---

 src/mesa/state_tracker/st_cb_eglimage.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_eglimage.c b/src/mesa/state_tracker/st_cb_eglimage.c
index 158a824e59..3a62ef7304 100644
--- a/src/mesa/state_tracker/st_cb_eglimage.c
+++ b/src/mesa/state_tracker/st_cb_eglimage.c
@@ -61,14 +61,14 @@ st_egl_image_get_surface(struct gl_context *ctx, GLeglImageOES image_handle,
    memset(&stimg, 0, sizeof(stimg));
    if (!smapi->get_egl_image(smapi, (void *) image_handle, &stimg)) {
       /* image_handle does not refer to a valid EGL image object */
-      _mesa_error(ctx, GL_INVALID_VALUE, error);
+      _mesa_error(ctx, GL_INVALID_VALUE, "%s(image handle not found)", error);
       return NULL;
    }
 
    if (!screen->is_format_supported(screen, stimg.format, PIPE_TEXTURE_2D,
                                     stimg.texture->nr_samples, usage)) {
       /* unable to specify a texture object using the specified EGL image */
-      _mesa_error(ctx, GL_INVALID_OPERATION, error);
+      _mesa_error(ctx, GL_INVALID_OPERATION, "%s(format not supported)", error);
       return NULL;
    }
 




More information about the mesa-commit mailing list