[Mesa-dev] [PATCH] mesa: do not use format string as literal string

Samuel Pitoiset samuel.pitoiset at gmail.com
Wed Jun 28 11:55:00 UTC 2017


Oops.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>

On 06/28/2017 01:46 PM, Juan A. Suarez Romero wrote:
> This fixes a couple of  errors when building in Android:
> 
> external/mesa3d/src/mesa/main/shaderapi.c:293:49: error: format string
> is not a string literal (potentially insecure)
> [-Werror,-Wformat-security]
>           _mesa_error(ctx, GL_INVALID_OPERATION, caller);
>                                                  ^~~~~~
> external/mesa3d/src/mesa/main/shaderapi.c:293:49: note: treat the string
> as an argument to avoid this
>           _mesa_error(ctx, GL_INVALID_OPERATION, caller);
>                                                  ^
> Signed-off-by: Juan A. Suarez Romero <jasuarez at igalia.com>
> ---
>   src/mesa/main/shaderapi.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
> index 0e46a09..84189f0 100644
> --- a/src/mesa/main/shaderapi.c
> +++ b/src/mesa/main/shaderapi.c
> @@ -290,7 +290,7 @@ attach_shader_err(struct gl_context *ctx, GLuint program, GLuint shader,
>             *     "The error INVALID_OPERATION is generated by AttachObjectARB
>             *     if <obj> is already attached to <containerObj>."
>             */
> -         _mesa_error(ctx, GL_INVALID_OPERATION, caller);
> +         _mesa_error(ctx, GL_INVALID_OPERATION, "%s", caller);
>            return;
>         } else if (same_type_disallowed &&
>                    shProg->Shaders[i]->Stage == sh->Stage) {
> @@ -302,7 +302,7 @@ attach_shader_err(struct gl_context *ctx, GLuint program, GLuint shader,
>            *      is generated if [...] another shader object of the same type
>            *      as shader is already attached to program."
>            */
> -         _mesa_error(ctx, GL_INVALID_OPERATION, caller);
> +         _mesa_error(ctx, GL_INVALID_OPERATION, "%s", caller);
>            return;
>         }
>      }
> 


More information about the mesa-dev mailing list