mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 02:10:11 +01:00
pan/clc: handle seek-error
lseek can return a negative value on error here. While it's not likely to happen, let's add some error-checking here to prevent bad behavior if we're unlucky. CID: 1648299 Reviewed-by: Eric R. Smith <eric.smith@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36724>
This commit is contained in:
parent
f886e08f36
commit
046710ce95
1 changed files with 7 additions and 0 deletions
|
|
@ -285,6 +285,13 @@ main(int argc, const char **argv)
|
|||
}
|
||||
|
||||
off_t spirv_len = lseek(fd, 0, SEEK_END);
|
||||
if (spirv_len < 0) {
|
||||
fprintf(stderr, "Failed to lseek to the end of the file: errno=%d, %s\n",
|
||||
errno, strerror(errno));
|
||||
close(fd);
|
||||
goto input_spirv_open_failed;
|
||||
}
|
||||
|
||||
const void *spirv_map = mmap(NULL, spirv_len, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
close(fd);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue