Fix queue extend to check bounds (#6324)

This commit is contained in:
Aleksander Kiryk 2025-08-23 16:37:40 +02:00 committed by GitHub
parent 1c86ff0af2
commit d56d1a7719
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 4 deletions

View File

@ -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;
}