| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…ackage managers from the build entirely
Not up to standards ⛔🔴 Issues 3 critical🟢 Metrics 0 complexity
TIP This summary will be updated as you push new changes. |
Sorry, something went wrong.
There was a problem hiding this comment.
The PR is currently not up to standards due to 3 new quality issues and significant gaps in implementation that could break the build and compromise security.
A critical issue was identified in CMakeLists.txt where an empty package manager disable list causes a syntax error in the C header. Additionally, a high-severity security risk (CWE-126) exists in src/common/impl/format.c, where strlen is used on string arguments that may not be null-terminated.
Several acceptance criteria regarding the new recursion depth limit and CMake conditional compilation lack corresponding unit or regression tests. These issues should be resolved before merging.
Consider implementing these tests if applicable: 1. Verify that building with `-DPACKAGES_REMOVE_DISABLED=ON` excludes the detection code for managers disabled via `-DPACKAGES_DISABLE_<NAME>`. 2. Verify that `json_encode` in Lua correctly throws an error when a table exceeds a nesting depth of 15. 3. Verify that `json_encode` handles circular references gracefully without crashing. 4. Successful compilation and runtime verification using Lua 5.3. 5. Verification that Base64 decoding remains functional after making `init_decode_table` static.
TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback
Sorry, something went wrong.
| list(JOIN PACKAGES_DISABLE_LIST " | " PACKAGES_DISABLE_LIST) | ||
| endif() | ||
| target_compile_definitions(libfastfetch PRIVATE FF_PACKAGES_DISABLE_LIST=${PACKAGES_DISABLE_LIST}) | ||
| target_compile_definitions(libfastfetch PRIVATE "FF_PACKAGES_DISABLE_LIST=${PACKAGES_DISABLE_LIST}") |
There was a problem hiding this comment.
🔴 HIGH RISK
This definition will cause a compilation error if PACKAGES_DISABLE_LIST is empty. You should ensure it defaults to a valid integer value or a bitmask flag that represents 'none' (e.g., FF_PACKAGES_FLAG_NONE) when the list is empty.
Try running the following prompt in your coding agent:
Update CMakeLists.txt to set PACKAGES_DISABLE_LIST to FF_PACKAGES_FLAG_NONE if it is empty before calling target_compile_definitions.
Sorry, something went wrong.
| break; | ||
| case FF_ARG_TYPE_STRING: | ||
| lua_pushstring(L, (const char*) arg->value); | ||
| lua_pushlstring(L, (const char*) arg->value, strlen((const char*) arg->value)); |
There was a problem hiding this comment.
🔴 HIGH RISK
Replacing the internal string handler with strlen introduces a dependency on null-termination that might not be guaranteed for all FF_ARG_TYPE_STRING inputs. Try running the following prompt in your IDE agent:
Since lua_pushstring is no longer available in the FFLuaData struct, review the usage of strlen in src/common/impl/format.c at line 194. Ensure all string arguments are null-terminated or update the FFformatarg structure to carry an explicit length for string types to avoid potential buffer over-reads.
Sorry, something went wrong.
| if (!doc) { | ||
| return luaL_error(L, "failed to create yyjson document"); | ||
| if (__builtin_expect(!doc, false)) { | ||
| lua_pushlstring(L, "yyjson: yyjson_mut_doc_new() failed", strlen("yyjson: yyjson_mut_doc_new() failed")); |
There was a problem hiding this comment.
⚪ LOW RISK
Use sizeof for constant literals to provide the length at compile time.
| lua_pushlstring(L, "yyjson: yyjson_mut_doc_new() failed", strlen("yyjson: yyjson_mut_doc_new() failed")); | |
| lua_pushlstring(L, "yyjson: yyjson_mut_doc_new() failed", sizeof("yyjson: yyjson_mut_doc_new() failed") - 1); |
Sorry, something went wrong.
| lua_pushlstring( | ||
| L, ": recursion depth exceeded; possible circular reference", | ||
| strlen(": recursion depth exceeded; possible circular reference") | ||
| ); |
There was a problem hiding this comment.
⚪ LOW RISK
Suggestion: Remove the leading colon from the error string for cleaner output (standard Lua errors do not start with a colon). Additionally, use sizeof for constant literals to calculate length at compile time rather than using strlen at runtime.
| lua_pushlstring( | |
| L, ": recursion depth exceeded; possible circular reference", | |
| strlen(": recursion depth exceeded; possible circular reference") | |
| ); | |
| sizeof(" recursion depth exceeded; possible circular reference") - 1 |
Sorry, something went wrong.
There was a problem hiding this comment.
Release bump to v2.64.1, combining a small build-time optimization for package detection, Lua/yyjson robustness + compatibility fixes, and macOS codec build compatibility adjustments.
Changes:
Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.
Show a summary per file| File | Description |
|---|---|
| CMakeLists.txt | Bumps project version; adds PACKAGES_REMOVE_DISABLED option and wires FF_PACKAGES_* compile definitions. |
| CHANGELOG.md | Adds 2.64.1 release notes for the new option and fixes. |
| src/modules/packages/option.h | Makes FFPackagesFlags explicitly UINT64_C-based and conditionally removes disabled from options. |
| src/modules/packages/packages.c | Conditionally compiles JSON parsing/config emission of disabled; initializes disabled defaults only when supported. |
| src/detection/packages/packages.h | Introduces FF_PACKAGES_IS_ENABLED() abstraction (runtime vs compile-time depending on FF_PACKAGES_REMOVE_DISABLED). |
| src/detection/packages/packages_linux.c | Switches per-manager checks to FF_PACKAGES_IS_ENABLED(). |
| src/detection/packages/packages_windows.c | Switches per-manager checks to FF_PACKAGES_IS_ENABLED(). |
| src/detection/packages/packages_apple.c | Switches per-manager checks to FF_PACKAGES_IS_ENABLED(). |
| src/detection/packages/packages_bsd.c | Switches per-manager checks to FF_PACKAGES_IS_ENABLED(). |
| src/detection/packages/packages_obsd.c | Switches per-manager checks to FF_PACKAGES_IS_ENABLED(). |
| src/detection/packages/packages_nbsd.c | Switches per-manager checks to FF_PACKAGES_IS_ENABLED(). |
| src/detection/packages/packages_sunos.c | Switches per-manager checks to FF_PACKAGES_IS_ENABLED(). |
| src/detection/packages/packages_haiku.c | Switches per-manager checks to FF_PACKAGES_IS_ENABLED(). |
| src/detection/codec/codec.h | Removes FF_CODEC_TYPE_JPEG_XL and updates FF_CODEC_TYPE_MAX. |
| src/modules/codec/codec.c | Removes JPEG XL string mapping (consistent with enum removal). |
| src/detection/codec/codec_apple.c | Uses FourCC literals to avoid relying on newer SDK constants; removes JPEG XL mapping. |
| src/common/lua.h | Adjusts dynamically-loaded Lua symbol set and wrappers. |
| src/common/impl/lua.c | Adds recursion-depth guard for json_encode and updates error paths to use lua_error. |
| src/common/impl/format.c | Replaces lua_pushstring usage with lua_pushlstring for loaded-symbol consistency. |
| src/common/impl/base64.c | Makes init_decode_table() static. |
Sorry, something went wrong.
| lua_pushlstring( | ||
| L, ": recursion depth exceeded; possible circular reference", | ||
| strlen(": recursion depth exceeded; possible circular reference") | ||
| ); |
| Back | FazBrowse Home | New Git URL |
Checklist