mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 05:01:49 +00:00
Two places where coverity urges us to limit string length
These two issues make sense, but there are probably others.
This commit is contained in:
parent
72af7f340c
commit
4ea0fd6af4
@ -66,6 +66,7 @@
|
|||||||
#include "support/unique_ptr.h"
|
#include "support/unique_ptr.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <iomanip>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@ -5356,6 +5357,8 @@ void InsetTabular::tabularFeatures(Cursor & cur, string const & argument)
|
|||||||
cur.recordUndoInset(this);
|
cur.recordUndoInset(this);
|
||||||
|
|
||||||
istringstream is(argument);
|
istringstream is(argument);
|
||||||
|
// limit the size of strings we read to avoid memory problems
|
||||||
|
is >> setw(65636);
|
||||||
string s;
|
string s;
|
||||||
// Safe guard.
|
// Safe guard.
|
||||||
size_t safe_guard = 0;
|
size_t safe_guard = 0;
|
||||||
|
@ -149,6 +149,8 @@ void initSymbols()
|
|||||||
}
|
}
|
||||||
|
|
||||||
ifstream fs(filename.toFilesystemEncoding().c_str());
|
ifstream fs(filename.toFilesystemEncoding().c_str());
|
||||||
|
// limit the size of strings we read to avoid memory problems
|
||||||
|
fs >> setw(65636);
|
||||||
string line;
|
string line;
|
||||||
bool skip = false;
|
bool skip = false;
|
||||||
while (getline(fs, line)) {
|
while (getline(fs, line)) {
|
||||||
@ -160,6 +162,8 @@ void initSymbols()
|
|||||||
// special case of iffont/else/endif
|
// special case of iffont/else/endif
|
||||||
if (line.size() >= 7 && line.substr(0, 6) == "iffont") {
|
if (line.size() >= 7 && line.substr(0, 6) == "iffont") {
|
||||||
istringstream is(line);
|
istringstream is(line);
|
||||||
|
// limit the size of strings we read to avoid memory problems
|
||||||
|
is >> setw(65636);
|
||||||
string tmp;
|
string tmp;
|
||||||
is >> tmp;
|
is >> tmp;
|
||||||
is >> tmp;
|
is >> tmp;
|
||||||
|
Loading…
Reference in New Issue
Block a user