Fix queue extend to check bounds (#6324)
This commit is contained in:
parent
1c86ff0af2
commit
d56d1a7719
|
|
@ -621,11 +621,8 @@ public:
|
|||
T_Value& atWriteAppend(int32_t index) {
|
||||
// cppcheck-suppress variableScope
|
||||
static thread_local T_Value t_throwAway;
|
||||
if (index == m_deque.size()) push_back(atDefault());
|
||||
if (VL_UNLIKELY(index < 0 || index >= m_deque.size())) {
|
||||
if (index == m_deque.size()) {
|
||||
push_back(atDefault());
|
||||
return m_deque[index];
|
||||
}
|
||||
t_throwAway = atDefault();
|
||||
return t_throwAway;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue