Commit d855afad authored by Orgad Shaneh's avatar Orgad Shaneh Committed by hjk
Browse files

ElfReader: Catch bad_alloc exception



Might happen on file.readAll() for large elf files.

Change-Id: Id338e647d2d0903d2071b5f35ffc7a00e6aca24d
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 9a5f81d9
......@@ -34,6 +34,8 @@
#include <QDir>
#include <QDebug>
#include <new> // std::bad_alloc
namespace Utils {
quint16 getHalfWord(const unsigned char *&s, const ElfData &context)
......@@ -113,7 +115,11 @@ bool ElfMapper::map()
ustart = file.map(0, fdlen);
if (ustart == 0) {
// Try reading the data into memory instead.
raw = file.readAll();
try {
raw = file.readAll();
} catch (std::bad_alloc &) {
return false;
}
start = raw.constData();
fdlen = raw.size();
}
......
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