Commit bec01778 authored by Robert Loehning's avatar Robert Loehning
Browse files

Fixed crash when trying to copy large binary file

Reviewed-by: Oswald Buddenhagen
Task-number: QTCREATORBUG-484
parent 2f84e65b
......@@ -41,6 +41,7 @@
#include <QtGui/QClipboard>
#include <QtGui/QFontMetrics>
#include <QtGui/QMenu>
#include <QtGui/QMessageBox>
#include <QtGui/QPainter>
#include <QtGui/QScrollBar>
#include <QtGui/QWheelEvent>
......@@ -1124,7 +1125,13 @@ void BinEditor::copy(bool raw)
const int selStart = selectionStart();
const int selEnd = selectionEnd();
if (selStart < selEnd) {
const QByteArray &data = dataMid(selStart, selEnd - selStart);
const int selectionLength = selEnd - selStart;
if (selectionLength >> 22) {
QMessageBox::warning(this, tr("Copying Failed"),
tr("You cannot copy more than 4 MB of binary data."));
return;
}
const QByteArray &data = dataMid(selStart, selectionLength);
if (raw) {
QApplication::clipboard()->setText(data);
return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment