Skip to content
Open
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
5 changes: 4 additions & 1 deletion Svc/DpCatalog/DpCatalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,10 @@ Fw::CmdResponse DpCatalog::fillBinaryTree() {
FwSizeType totalFiles = 0;

// get file listings from file system
for (FwSizeType dir = 0; dir < this->m_numDirectories; dir++) {
const FwSizeType numDirs = (this->m_numDirectories <= DP_MAX_DIRECTORIES)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be more readable to use std::min(this->m_numDirectories, DP_MAX_DIRECTORIES) ?

But also this is provable / asserted in configure() :

FW_ASSERT(numDirs <= DP_MAX_DIRECTORIES, static_cast<FwAssertArgType>(numDirs));

My vote would be to dispose of this static analysis warning as a false positive

Copy link
Copy Markdown
Collaborator

@thomas-bc thomas-bc Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't feel like the right fix to me. If m_numDirectories is more than DP_MAX_DIRECTORY, something majorly wrong is going on. Probably coding error, or bitflips or whatever. Silently clamping the range doesn't sound right. I vote we either ASSERT, or dispose of static analysis as false positive.

? this->m_numDirectories
: static_cast<FwSizeType>(DP_MAX_DIRECTORIES);
for (FwSizeType dir = 0; dir < numDirs; dir++) {
// read in each directory and keep track of total
this->log_ACTIVITY_LO_ProcessingDirectory(this->m_directories[dir]);
FwSizeType filesRead = 0;
Expand Down
Loading