Merge pull request #14469 from slopgobblercobbler/test/userservice-id-range-coverage

test(libSceUserService): cover out-of-range user ID rejection in sceUserServiceGetUserName
This commit is contained in:
Dean authored and GitHub committed 2026-11-03 11:37:25 +13:00
commit f0fde2bf76
1 file changed
+6
+6
View File
@@ -9,6 +9,8 @@
namespace {
constexpr int SCE_USER_SERVICE_ERROR_INVALID_USER_ID = USER_SERVICE_ERROR_UNKNOWN_USER;
void Require(bool value) { if (!value) std::abort(); }
void SetLanguage(const char* value) {
@@ -190,6 +192,10 @@ int main() {
char name[32]{};
Require(sceUserServiceGetUserName(USER_SERVICE_INITIAL_USER_ID, nullptr, sizeof(name)) == USER_SERVICE_ERROR_INVALID_ARGUMENT);
Require(sceUserServiceGetUserName(123, name, sizeof(name)) == USER_SERVICE_ERROR_UNKNOWN_USER);
Require(sceUserServiceGetUserName(0x10000004, name, sizeof(name)) == SCE_USER_SERVICE_ERROR_INVALID_USER_ID);
Require(sceUserServiceGetUserName(static_cast<int>(0xFFFFFFFFu), name, sizeof(name)) == SCE_USER_SERVICE_ERROR_INVALID_USER_ID);
Require(sceUserServiceGetUserName(USER_SERVICE_INITIAL_USER_ID + USER_SERVICE_MAX_USERS, name, sizeof(name)) == USER_SERVICE_ERROR_UNKNOWN_USER);
Require(sceUserServiceGetUserName(USER_SERVICE_USER_ID_INVALID, name, sizeof(name)) == USER_SERVICE_ERROR_UNKNOWN_USER);
Require(sceUserServiceGetUserName(USER_SERVICE_INITIAL_USER_ID, name, 5) == USER_SERVICE_ERROR_BUFFER_TOO_SHORT);
Require(sceUserServiceGetUserName(USER_SERVICE_INITIAL_USER_ID, name, sizeof(name)) == USER_SERVICE_OK);
Require(std::strcmp(name, "Player") == 0);