Fix heap-buffer overflow in PLY parser
parent
bfe8745b90
commit
e4e2c63e0c
|
@ -425,7 +425,8 @@ bool PLY::DOM::ParseHeader(IOStreamBuffer<char> &streamBuffer, std::vector<char>
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
// ignore unknown header elements
|
// ignore unknown header elements
|
||||||
streamBuffer.getNextLine(buffer);
|
if (!streamBuffer.getNextLine(buffer))
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -287,7 +287,7 @@ static AI_FORCE_INLINE bool isEndOfCache(size_t pos, size_t cacheSize) {
|
||||||
template <class T>
|
template <class T>
|
||||||
AI_FORCE_INLINE bool IOStreamBuffer<T>::getNextLine(std::vector<T> &buffer) {
|
AI_FORCE_INLINE bool IOStreamBuffer<T>::getNextLine(std::vector<T> &buffer) {
|
||||||
buffer.resize(m_cacheSize);
|
buffer.resize(m_cacheSize);
|
||||||
if (isEndOfCache(m_cachePos, m_cacheSize) || 0 == m_filePos) {
|
if (m_cachePos >= m_cacheSize || 0 == m_filePos) {
|
||||||
if (!readNextBlock()) {
|
if (!readNextBlock()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue