[Mesa-dev] [PATCH] intel: tools: Fix aubinator_error's fprintf call (format-security)

Kai Wasserbäch kai at dev.carbon-project.org
Sat Aug 25 10:00:30 UTC 2018


The recent commit 4616639b49b4bbc91e503c1c27632dccc1c2b5be introduced
the new function aubinator_error() which is a trivial wrapper around
fprintf() to STDERR. The call to fprintf() however is passed the message
msg directly:
  fprintf(stderr, msg);

This is a format-security violation and leads to an FTBFS with
-Werror=format-security (GCC 8):
  ../../../src/intel/tools/aubinator.c: In function 'aubinator_error':
  ../../../src/intel/tools/aubinator.c:74:4: error: format not a string literal and no format arguments [-Werror=format-security]
      fprintf(stderr, msg);
      ^~~~~~~

This patch fixes this trivially by introducing a catch-all "%s" format
argument.

Fixes: 4616639b49b ("intel: tools: split aub parsing from aubinator")
Cc: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Signed-off-by: Kai Wasserbäch <kai at dev.carbon-project.org>
---

Hey,
just tried compiling the latest version of Mesa but due to commit
4616639b49b4bbc91e503c1c27632dccc1c2b5be by Lionel I got a FTBFS. Please
commit this patch for me, if you accept it. I do not have commit access
for Mesa.

The pull request for this would be:
 The following changes since commit 1281608849a058fcdbe2f64481a159d58af3d888:

   gallium: Split out PIPE_CAP_TEXTURE_MIRROR_CLAMP_TO_EDGE. (2018-08-24 17:25:36 -0700)

 are available in the Git repository at:

   https://gitlab.freedesktop.org/curan/mesa.git aub-format-security

 for you to fetch changes up to 24957b0db3c12a097d70033ec8596da5bafedd55:

   intel: tools: Fix aubinator_error's fprintf call (format-security) (2018-08-25 11:43:25 +0200)

Cheers,
Kai

 src/intel/tools/aubinator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
index 374ed46f86..c22d191f14 100644
--- a/src/intel/tools/aubinator.c
+++ b/src/intel/tools/aubinator.c
@@ -71,7 +71,7 @@ struct brw_instruction;
 static void
 aubinator_error(void *user_data, const void *aub_data, const char *msg)
 {
-   fprintf(stderr, msg);
+   fprintf(stderr, "%s", msg);
 }
 
 static void
-- 
2.18.0



More information about the mesa-dev mailing list