GPU: Fix out of bound write when logging system paths
Blender expects that only the filename is provided which is true for internal shader sources. Metal shaders can error and return a full path to a system shader. This doesn't fit inside the reserved memory that Blender reserved for logging filename and line number. This out of bound write can be triggered when using `min` where the parameters aren't of the same kind. `uint min(uint, int)` for example. This PR reserves more space to store the filename. Pull Request: https://projects.blender.org/blender/blender/pulls/120967
This commit is contained in:
@@ -210,8 +210,8 @@ void Shader::print_log(Span<const char *> sources,
|
||||
}
|
||||
/* Print the filename the error line is coming from. */
|
||||
if (!log_item.cursor.file_name_and_error_line.is_empty()) {
|
||||
char name_buf[128];
|
||||
log_item.cursor.file_name_and_error_line.copy(name_buf);
|
||||
char name_buf[256];
|
||||
log_item.cursor.file_name_and_error_line.substr(0, sizeof(name_buf) - 1).copy(name_buf);
|
||||
BLI_dynstr_appendf(dynstr, "%s%s: %s", info_col, name_buf, reset_col);
|
||||
}
|
||||
else if (source_index > 0) {
|
||||
|
||||
Reference in New Issue
Block a user