When uIdx >= m_vsParams.size() and the vector is non-empty, the comparison at src/Message.cpp:57:
if (uLen > m_vsParams.size() - uIdx - 1)
underflows to SIZE_MAX. No current call site passes a combination of arguments that makes this reachable in practice -the default uLen=-1 causes the loop bound to overflow harmlessly. But the check is wrong and a future caller passing an explicit uLen with an out-of-bounds uIdx would hit UB.
The fix is a single bounds check matching the one already in GetParam():
if (uIdx >= m_vsParams.size()) return "";
Same issue exists in GetParamsSplit() at src/Message.cpp:316.
## Summary:
When uIdx >= m_vsParams.size() and the vector is non-empty, the comparison at src/Message.cpp:57:
` if (uLen > m_vsParams.size() - uIdx - 1)`
underflows to SIZE_MAX. No current call site passes a combination of arguments that makes this reachable in practice -the default uLen=-1 causes the loop bound to overflow harmlessly. But the check is wrong and a future caller passing an explicit uLen with an out-of-bounds uIdx would hit UB.
The fix is a single bounds check matching the one already in `GetParam()`:
` if (uIdx >= m_vsParams.size()) return "";`
Same issue exists in `GetParamsSplit()` at `src/Message.cpp:316.`
<!-- github-sync-id:4085866366 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary:
When uIdx >= m_vsParams.size() and the vector is non-empty, the comparison at src/Message.cpp:57:
if (uLen > m_vsParams.size() - uIdx - 1)underflows to SIZE_MAX. No current call site passes a combination of arguments that makes this reachable in practice -the default uLen=-1 causes the loop bound to overflow harmlessly. But the check is wrong and a future caller passing an explicit uLen with an out-of-bounds uIdx would hit UB.
The fix is a single bounds check matching the one already in
GetParam():if (uIdx >= m_vsParams.size()) return "";Same issue exists in
GetParamsSplit()atsrc/Message.cpp:316.