Merge pull request from GHSA-cfcv-789h-3pg3
GHSL-2023-112: check if the current pointer and the next one are less than the endpull/14086/head
commit
4b66d80b2f
|
@ -152,7 +152,7 @@ size_t Utf8_16_Read::convert(char* buf, size_t len)
|
||||||
case uni16LE_NoBOM:
|
case uni16LE_NoBOM:
|
||||||
case uni16BE:
|
case uni16BE:
|
||||||
case uni16LE: {
|
case uni16LE: {
|
||||||
size_t newSize = len + len / 2 + 1;
|
size_t newSize = (len + len % 2) + (len + len % 2) / 2;
|
||||||
|
|
||||||
if (m_nAllocatedBufSize != newSize)
|
if (m_nAllocatedBufSize != newSize)
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,7 +53,9 @@ public:
|
||||||
bool get(utf8 *c);
|
bool get(utf8 *c);
|
||||||
void operator++();
|
void operator++();
|
||||||
eState getState() { return m_eState; };
|
eState getState() { return m_eState; };
|
||||||
operator bool() { return (m_pRead < m_pEnd) || (m_out1st != m_outLst); };
|
// Utf8_16::read always consumes two bytes,
|
||||||
|
// thus the bool operator checks if m_pRead is less than m_pEnd by two bytes.
|
||||||
|
operator bool() { return (m_pRead + 1 < m_pEnd) || (m_out1st != m_outLst); };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void read();
|
void read();
|
||||||
|
|
Loading…
Reference in New Issue