issue: 4456561 Fix handle of size_t type in config
Description
Add proper support for size_t type in the configuration registry system. The changes include:
- Add a static assertion to prevent direct use of size_t with get_value
- Create a specialized template function for size_t types
- Implement safe casting between int64_t and size_t
- Update template constraints to account for the size_t specialization
- Add documentation to explain the specialized handling
Why ?
core.syscall.sendfile_cache_limit and core.resources.external_memory_limit could not correctly be set (found when simply adding the static_assert)
Change type
What kind of change does this PR introduce?
- [X] Bugfix
- [ ] Feature
- [ ] Code style update
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Documentation content changes
- [ ] Tests
- [ ] Other
Check list
- [ ] Code follows the style de facto guidelines of this project
- [ ] Comments have been inserted in hard to understand places
- [ ] Documentation has been updated (if necessary)
- [ ] Test has been added (if possible)
/review
/improve
PR Reviewer Guide 🔍
Here are some key observations to aid the review process:
| ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪ |
| 🧪 No relevant tests |
| 🔒 No security concerns identified |
⚡ Recommended focus areas for reviewPossible Issue
int64_t to size_t in the set_value_from_registry_if_exists specialization for size_t should be carefully reviewed to ensure that no data loss or overflow occurs, especially on platforms where size_t and int64_t have different ranges. |
PR Code Suggestions ✨
| Category | Suggestion | Impact |
| Possible issue |
Validate non-negative values before castingAdd a check to ensure that the value retrieved from the registry is non-negative src/core/util/sys_vars.cpp [3147-3149]
Suggestion importance[1-10]: 9__ Why: This suggestion addresses a critical issue where casting a negative | High |
| General |
Clarify static assertion messageUpdate the static assertion message to clarify why src/core/config/config_registry.h [168]
Suggestion importance[1-10]: 5__ Why: While the updated message provides additional clarity for developers, it does not directly impact functionality or correctness. The improvement is helpful for debugging and understanding the code but has a moderate impact overall. | Low |
@tomerdbz please move to fix/close