-
-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
failed to build in gentoo #1907
Comments
That looks like incorrect diagnostics because it fails to properly analyse the flow. But I changed it so hopefully it now compiles for you. |
@lerno, thank you for the prompt fix. unfortunately, there is next problem with compilation but i can feel we're close and close to the final success build in gentoo. (btw. i can provide you here is a piece of log message with an error but i'm enclosing a full build log for better investigaton...
|
i've just investigated the code and you don't handle a buffer overflow well at line 500 in the file const char *file_append_path_temp(const char *path, const char *name) {
size_t path_len = strlen(path);
if (path_len == 0) return name; // if no path, return name directly
size_t name_len = strlen(name);
// ensure there's space for path, separator, name, and null terminator
if (path_len + name_len + 2 > PATH_BUFFER_SIZE) {
error_exit("Error generating path from %s and %s: buffer max size exceeded.", path, name);
return NULL;
}
// determine if we need a separator
char separator = '/';
#if defined(_WIN32)
separator = '\\';
#endif
// format the string safely
int written;
if (path[path_len - 1] == '/' || path[path_len - 1] == '\\') {
written = snprintf(path_buffer, PATH_BUFFER_SIZE, "%s%s", path, name);
} else {
written = snprintf(path_buffer, PATH_BUFFER_SIZE, "%s%c%s", path, separator, name);
}
// check if truncation occurred
if (written < 0 || (size_t)written >= PATH_BUFFER_SIZE) {
error_exit("Error generating path from %s and %s: snprintf truncation occurred.", path, name);
return NULL;
}
return path_buffer;
} |
as soon as the code above is fixed you can provide all gentoo users c3-9999.ebuild and c3-0.6.6.ebuild. |
I modified it slightly, hopefully it still passes. |
i've updated the links for my ebuilds above and i can confirm it works great in gentoo now. however, i have to ask you if your changed code below is really ok primarily for non windows platform ( bool insert_separator = path[path_len - 1] == '/' || path[path_len - 1] == separator; |
Yes, should be fine since both comparisons are the same. |
hi, trying to build the latest version from git in gentoo...
FAILED: CMakeFiles/c3c.dir/src/compiler/sema_stmts.c.o /usr/bin/x86_64-pc-linux-gnu-gcc -DCURL_FOUND=1 -DLLVM_AVAILABLE=1 -DTB_AVAILABLE=0 -I/usr/lib/llvm/19/include -I/var/tmpfs/portage/dev-lang/c3-9999/work/c3-9999/src -I/var/tmpfs/portage/dev-lang/c3-9999/work/c3-9999_build -I/var/tmpfs/portage/dev-lang/c3-9999/work/c3-9999/wrapper/include -I/var/tmpfs/portage/dev-lang/c3-9999/work/c3-9999/dependencies/miniz -march=native -O2 -pipe -std=gnu11 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -pthread -Wall -Werror -Wno-unknown-pragmas -Wno-unused-result -Wno-unused-function -Wno-unused-variable -Wno-unused-parameter -MD -MT CMakeFiles/c3c.dir/src/compiler/sema_stmts.c.o -MF CMakeFiles/c3c.dir/src/compiler/sema_stmts.c.o.d -o CMakeFiles/c3c.dir/src/compiler/sema_stmts.c.o -c /var/tmpfs/portage/dev-lang/c3-9999/work/c3-9999/src/compiler/sema_stmts.c In function ‘sema_analyse_ct_foreach_stmt’, inlined from ‘sema_analyse_statement_inner’ at /var/tmpfs/portage/dev-lang/c3-9999/work/c3-9999/src/compiler/sema_stmts.c:3139:11: /var/tmpfs/portage/dev-lang/c3-9999/work/c3-9999/src/compiler/sema_stmts.c:2805:32: error: ‘count’ may be used uninitialized [-Werror=maybe-uninitialized] 2805 | for (unsigned i = 0; i < count; i++) | ~~^~~~~~~ /var/tmpfs/portage/dev-lang/c3-9999/work/c3-9999/src/compiler/sema_stmts.c: In function ‘sema_analyse_statement_inner’: /var/tmpfs/portage/dev-lang/c3-9999/work/c3-9999/src/compiler/sema_stmts.c:2727:18: note: ‘count’ was declared here 2727 | unsigned count; | ^~~~~ cc1: all warnings being treated as errors
The text was updated successfully, but these errors were encountered: