diff options
author | Robert Loehning <robert.loehning@qt.io> | 2017-03-21 13:24:02 +0100 |
---|---|---|
committer | Robert Loehning <robert.loehning@qt.io> | 2017-03-21 13:01:00 +0000 |
commit | 8f94691ad6db53112c9b032d7776927aa573de5e (patch) | |
tree | d0d25b4137d62138f0cbd5c2b9c3a4acc4b2f78a /src/plugins/bineditor | |
parent | 09361075799f7fe29eb76e8e45500e43d4ab3688 (diff) | |
download | qt-creator-8f94691ad6db53112c9b032d7776927aa573de5e.tar.gz |
BinEditor: Avoid overflows in dataLastIndexOf
Change-Id: I1f248f0c11209c60714f949d8f052326e86c9354
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/bineditor')
-rw-r--r-- | src/plugins/bineditor/bineditorwidget.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/bineditor/bineditorwidget.cpp b/src/plugins/bineditor/bineditorwidget.cpp index 1814614296..e647432723 100644 --- a/src/plugins/bineditor/bineditorwidget.cpp +++ b/src/plugins/bineditor/bineditorwidget.cpp @@ -645,7 +645,7 @@ int BinEditorWidget::dataLastIndexOf(const QByteArray &pattern, qint64 from, boo int block = from / m_blockSize; const int lowerBound = qMax(qint64(0), from - SearchStride); while (from > lowerBound) { - if (!requestDataAt(block * m_blockSize)) + if (!requestDataAt(qint64(block) * m_blockSize)) return -1; QByteArray data = blockData(block); ::memcpy(b + m_blockSize, b, trailing); @@ -658,7 +658,7 @@ int BinEditorWidget::dataLastIndexOf(const QByteArray &pattern, qint64 from, boo if (pos >= 0) return pos + block * m_blockSize; --block; - from = block * m_blockSize + (m_blockSize-1) + trailing; + from = qint64(block) * m_blockSize + (m_blockSize-1) + trailing; } return lowerBound == 0 ? -1 : -2; } |