Description
In the definition of StatBuffer in https://github.com/eclipse-score/baselibs/blob/main/score/os/stat.h#L43 the library score/os types st_uid to std::int64_t.
But POSIX defines the type as "an arithmetic type with appropriate length" and further "as an integer type" (https://pubs.opengroup.org/onlinepubs/007904875/basedefs/sys/types.h.html#tag_13_67).
There is no restriction, that it is a signed integer.
Thus, the static_cast in https://github.com/eclipse-score/baselibs/blob/main/score/os/stat_impl.cpp#L106 is unsound when the system uses as underlying type std::uint64_t and the user id is higher than std::numeric_limits<std::int64_t>::max().
Arguably this is rare to happen but also not ruled out. Therefore, this remains a safety issue.
CodeQL finding that raised this issue downstream: https://github.com/eclipse-score/communication/security/code-scanning/14104
Analysis results
No response
Solution
No response
Error Occurrence Rate
None
How to reproduce
No response
Supporting Information
No response
Classification
Minor
First Affected Release
not released (main)
Last Affected Release
not released (main)
Expected Fixed Release
before release (main)
Category
Description
In the definition of
StatBufferin https://github.com/eclipse-score/baselibs/blob/main/score/os/stat.h#L43 the library score/os typesst_uidtostd::int64_t.But POSIX defines the type as "an arithmetic type with appropriate length" and further "as an integer type" (https://pubs.opengroup.org/onlinepubs/007904875/basedefs/sys/types.h.html#tag_13_67).
There is no restriction, that it is a signed integer.
Thus, the
static_castin https://github.com/eclipse-score/baselibs/blob/main/score/os/stat_impl.cpp#L106 is unsound when the system uses as underlying typestd::uint64_tand the user id is higher thanstd::numeric_limits<std::int64_t>::max().Arguably this is rare to happen but also not ruled out. Therefore, this remains a safety issue.
CodeQL finding that raised this issue downstream: https://github.com/eclipse-score/communication/security/code-scanning/14104
Analysis results
No response
Solution
No response
Error Occurrence Rate
None
How to reproduce
No response
Supporting Information
No response
Classification
Minor
First Affected Release
not released (main)
Last Affected Release
not released (main)
Expected Fixed Release
before release (main)
Category