mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 03:35:53 +01:00
Limit line lengths in line-based parsers
This commit is contained in:
parent
99365c3ac8
commit
74b73d8700
@ -18,7 +18,7 @@ bool ITNParser::parse(QFile *file, QList<TrackData> &tracks,
|
||||
_errorString.clear();
|
||||
|
||||
while (!file->atEnd()) {
|
||||
ba = file->readLine();
|
||||
ba = file->readLine(4096);
|
||||
|
||||
QList<QByteArray> fields(ba.split('|'));
|
||||
if (fields.size() < 4) {
|
||||
|
@ -45,7 +45,7 @@ bool PLTParser::parse(QFile *file, QList<TrackData> &tracks,
|
||||
SegmentData &segment = track.last();
|
||||
|
||||
while (!file->atEnd()) {
|
||||
QByteArray line = file->readLine();
|
||||
QByteArray line = file->readLine(4096);
|
||||
|
||||
if (_errorLine == 1) {
|
||||
QString fileType(QString::fromUtf8(line).trimmed());
|
||||
@ -133,7 +133,7 @@ bool RTEParser::parse(QFile *file, QList<TrackData> &tracks,
|
||||
|
||||
|
||||
while (!file->atEnd()) {
|
||||
QByteArray line = file->readLine();
|
||||
QByteArray line = file->readLine(4096);
|
||||
|
||||
if (_errorLine == 1) {
|
||||
QString fileType(QString::fromUtf8(line).trimmed());
|
||||
@ -233,7 +233,7 @@ bool WPTParser::parse(QFile *file, QList<TrackData> &tracks,
|
||||
_errorString.clear();
|
||||
|
||||
while (!file->atEnd()) {
|
||||
QByteArray line = file->readLine();
|
||||
QByteArray line = file->readLine(4096);
|
||||
|
||||
if (_errorLine == 1) {
|
||||
QString fileType(QString::fromUtf8(line).trimmed());
|
||||
|
@ -90,7 +90,7 @@ bool TwoNavParser::parse(QFile *file, QList<TrackData> &tracks,
|
||||
}
|
||||
|
||||
while (!file->atEnd()) {
|
||||
QByteArray line(file->readLine().trimmed());
|
||||
QByteArray line(file->readLine(4096).trimmed());
|
||||
if (!line.size())
|
||||
continue;
|
||||
|
||||
|
@ -45,7 +45,7 @@ void Ellipsoid::loadList(const QString &path)
|
||||
while (!file.atEnd()) {
|
||||
ln++;
|
||||
|
||||
QByteArray line = file.readLine();
|
||||
QByteArray line = file.readLine(4096);
|
||||
QList<QByteArray> list = line.split(',');
|
||||
if (list.size() != 4) {
|
||||
qWarning("%s: %d: Format error", qPrintable(path), ln);
|
||||
|
@ -104,7 +104,7 @@ void GCS::loadList(const QString &path)
|
||||
while (!file.atEnd()) {
|
||||
ln++;
|
||||
|
||||
QByteArray line = file.readLine();
|
||||
QByteArray line = file.readLine(4096);
|
||||
QList<QByteArray> list = line.split(',');
|
||||
if (list.size() != 14) {
|
||||
qWarning("%s:%d: Format error", qPrintable(path), ln);
|
||||
|
@ -24,7 +24,7 @@ int MapFile::parse(QIODevice &device, QList<CalibrationPoint> &points,
|
||||
|
||||
|
||||
while (!device.atEnd()) {
|
||||
QByteArray line = device.readLine();
|
||||
QByteArray line = device.readLine(4096);
|
||||
|
||||
if (ln == 1) {
|
||||
QString fileType(QString::fromUtf8(line).trimmed());
|
||||
|
@ -151,7 +151,7 @@ void PCS::loadList(const QString &path)
|
||||
while (!file.atEnd()) {
|
||||
ln++;
|
||||
|
||||
QByteArray line = file.readLine();
|
||||
QByteArray line = file.readLine(4096);
|
||||
QList<QByteArray> list = line.split(',');
|
||||
if (list.size() != 28) {
|
||||
qWarning("%s:%d: Format error", qPrintable(path), ln);
|
||||
|
@ -93,7 +93,7 @@ bool Tar::loadTmi(const QString &path)
|
||||
return false;
|
||||
|
||||
while (!file.atEnd()) {
|
||||
QByteArray line = file.readLine();
|
||||
QByteArray line = file.readLine(4096);
|
||||
int pos = line.indexOf(':');
|
||||
if (line.size() < 10 || pos < 7 || !line.startsWith("block")) {
|
||||
qWarning("%s:%d: syntax error", qPrintable(path), ln);
|
||||
|
@ -13,7 +13,7 @@ WLDFile::WLDFile(const QString &fileName)
|
||||
}
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
QByteArray line(file.readLine().trimmed());
|
||||
QByteArray line(file.readLine(128).trimmed());
|
||||
val[i] = line.toDouble(&ok);
|
||||
if (!ok) {
|
||||
_errorString = line + ": invalid parameter";
|
||||
|
Loading…
Reference in New Issue
Block a user