forked from qt-creator/qt-creator
BinEditor: Crash less on search
Task-number: QTCREATORBUG-21473 Task-number: QTCREATORBUG-23978 Change-Id: I8f63fa892b9ef37bc660bd0b96fce5e1d6772b57 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Robert Loehning <robert.loehning@qt.io>
This commit is contained in:
@@ -613,7 +613,6 @@ int BinEditorWidget::dataIndexOf(const QByteArray &pattern, qint64 from, bool ca
|
||||
|
||||
QByteArray buffer;
|
||||
buffer.resize(m_blockSize + trailing);
|
||||
char *b = buffer.data();
|
||||
QByteArrayMatcher matcher(pattern);
|
||||
|
||||
qint64 block = from / m_blockSize;
|
||||
@@ -622,6 +621,7 @@ int BinEditorWidget::dataIndexOf(const QByteArray &pattern, qint64 from, bool ca
|
||||
if (!requestDataAt(block * m_blockSize))
|
||||
return -1;
|
||||
QByteArray data = blockData(block);
|
||||
char *b = buffer.data();
|
||||
::memcpy(b, b + m_blockSize, trailing);
|
||||
::memcpy(b + trailing, data.constData(), m_blockSize);
|
||||
|
||||
@@ -645,7 +645,6 @@ int BinEditorWidget::dataLastIndexOf(const QByteArray &pattern, qint64 from, boo
|
||||
|
||||
QByteArray buffer;
|
||||
buffer.resize(m_blockSize + trailing);
|
||||
char *b = buffer.data();
|
||||
|
||||
if (from == -1)
|
||||
from = m_size;
|
||||
@@ -655,6 +654,7 @@ int BinEditorWidget::dataLastIndexOf(const QByteArray &pattern, qint64 from, boo
|
||||
if (!requestDataAt(qint64(block) * m_blockSize))
|
||||
return -1;
|
||||
QByteArray data = blockData(block);
|
||||
char *b = buffer.data();
|
||||
::memcpy(b + m_blockSize, b, trailing);
|
||||
::memcpy(b, data.constData(), m_blockSize);
|
||||
|
||||
|
Reference in New Issue
Block a user