compiler: use PATH_MAX for SPIR-V capture filename

Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36472>
This commit is contained in:
Caleb Callaway 2025-07-28 18:09:23 +00:00 committed by Marge Bot
parent 9f893de953
commit 16a855ae61

View file

@ -45,6 +45,10 @@
#include <stdio.h> #include <stdio.h>
#ifndef PATH_MAX
#define PATH_MAX 4096
#endif
/* Table of all implemented capabilities. These are the capabilities that are /* Table of all implemented capabilities. These are the capabilities that are
* implemented in the spirv_to_nir, not what the device supports. * implemented in the spirv_to_nir, not what the device supports.
* *
@ -343,7 +347,7 @@ vtn_dump_shader(struct vtn_builder *b, const char *path, const char *prefix)
{ {
static int idx = 0; static int idx = 0;
char filename[1024]; char filename[PATH_MAX];
int len = snprintf(filename, sizeof(filename), "%s/%s-%d.spirv", int len = snprintf(filename, sizeof(filename), "%s/%s-%d.spirv",
path, prefix, idx++); path, prefix, idx++);
if (len < 0 || len >= sizeof(filename)) if (len < 0 || len >= sizeof(filename))