Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions projects/rccl/src/misc/recorder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -609,8 +609,22 @@ void parseJsonEntry(const char* entry, std::vector<rcclApiCall>& calls)
// TODO: parse comma too
rcclApiCall call;
std::string str(entry);

// Handle empty string case
if (str.empty()) {
printf("[ERROR] parseJsonEntry: empty entry string\n");
return;
}

size_t begin = str.find_first_not_of(' ');
size_t end = str.find(" : ");

// Validate that we found the delimiter and positions are valid
if (begin == std::string::npos || end == std::string::npos || end <= begin) {
printf("[ERROR] parseJsonEntry: invalid entry format: '%s'\n", entry);
return;
}

rcclCall_t type = getFuncType(str.substr(begin, end-begin));
call.type = type;
switch(type) {
Expand Down
2 changes: 2 additions & 0 deletions projects/rccl/test/ArgCheckTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,11 +479,13 @@ TEST(ArgCheckTest, ArgsCheck_InvalidCommunicatorPointers)
{
ASSERT_EQ(hipFree((void*)env.info->sendbuff), hipSuccess);
env.info->sendbuff = nullptr; // Invalid send buffer
env.sendDevicePtr = nullptr; // Prevent double-free in cleanup
}
if(env.info->recvbuff)
{
ASSERT_EQ(hipFree((void*)env.info->recvbuff), hipSuccess);
env.info->recvbuff = nullptr; // Invalid receive buffer
env.recvDevicePtr = nullptr; // Prevent double-free in cleanup
}

ncclResult_t result = ArgsCheck(env.info);
Expand Down
Loading