OsmFileReader may fail due to unsigned integer underflow/overflow
OsmFileReader may fail due to unsigned integer underflow/overflow, resulting in an incorrect end-of-file calculation.
Variable bytes_read
can be assigned a negative value, which causes underflow.
It may happen that the expression (m_ui64CPIODataSize - m_cpioHeader.m_ui64FileSize)
may have a value greater than bytes_read
if (m_ui64CPIODataSize > m_cpioHeader.m_ui64FileSize && bytes_read > 0) {
bytes_read = bytes_read - (m_ui64CPIODataSize - m_cpioHeader.m_ui64FileSize);
}
Edited by Jacek Maksymilian Chodak