Avoid reading outside allocated buffer
Bound the inverse lookup result on the low end as well. Pick-to: 6.4 6.3 6.2 Fixes: QTBUG-104583 Change-Id: Id357fe1c39c88776075d737b08fc2864a2b6e829 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>bb10
parent
a0ecc14f30
commit
a2501fff81
|
|
@ -105,6 +105,8 @@ public:
|
|||
uint32_t i = static_cast<uint32_t>(std::floor(resultLargerThan * (m_tableSize - 1)));
|
||||
auto it = std::lower_bound(m_table16.cbegin() + i, m_table16.cend(), v);
|
||||
i = it - m_table16.cbegin();
|
||||
if (i == 0)
|
||||
return 0.0f;
|
||||
if (i >= m_tableSize - 1)
|
||||
return 1.0f;
|
||||
const float y1 = m_table16[i - 1];
|
||||
|
|
@ -119,6 +121,8 @@ public:
|
|||
uint32_t i = static_cast<uint32_t>(std::floor(resultLargerThan * (m_tableSize - 1)));
|
||||
auto it = std::lower_bound(m_table8.cbegin() + i, m_table8.cend(), v);
|
||||
i = it - m_table8.cbegin();
|
||||
if (i == 0)
|
||||
return 0.0f;
|
||||
if (i >= m_tableSize - 1)
|
||||
return 1.0f;
|
||||
const float y1 = m_table8[i - 1];
|
||||
|
|
|
|||
Loading…
Reference in New Issue