forked from boostorg/regex
Added checks for bad input files
[SVN r21321]
This commit is contained in:
@ -86,6 +86,7 @@ using namespace std;
|
|||||||
void load_file(std::string& s, std::istream& is)
|
void load_file(std::string& s, std::istream& is)
|
||||||
{
|
{
|
||||||
s.erase();
|
s.erase();
|
||||||
|
if(is.bad()) return;
|
||||||
s.reserve(is.rdbuf()->in_avail());
|
s.reserve(is.rdbuf()->in_avail());
|
||||||
char c;
|
char c;
|
||||||
while(is.get(c))
|
while(is.get(c))
|
||||||
|
@ -83,6 +83,7 @@ using namespace std;
|
|||||||
void load_file(std::string& s, std::istream& is)
|
void load_file(std::string& s, std::istream& is)
|
||||||
{
|
{
|
||||||
s.erase();
|
s.erase();
|
||||||
|
if(is.bad()) return;
|
||||||
s.reserve(is.rdbuf()->in_avail());
|
s.reserve(is.rdbuf()->in_avail());
|
||||||
char c;
|
char c;
|
||||||
while(is.get(c))
|
while(is.get(c))
|
||||||
|
@ -106,6 +106,7 @@ using namespace std;
|
|||||||
void load_file(std::string& s, std::istream& is)
|
void load_file(std::string& s, std::istream& is)
|
||||||
{
|
{
|
||||||
s.erase();
|
s.erase();
|
||||||
|
if(is.bad()) return;
|
||||||
s.reserve(is.rdbuf()->in_avail());
|
s.reserve(is.rdbuf()->in_avail());
|
||||||
char c;
|
char c;
|
||||||
while(is.get(c))
|
while(is.get(c))
|
||||||
|
@ -105,6 +105,7 @@ using namespace std;
|
|||||||
void load_file(std::string& s, std::istream& is)
|
void load_file(std::string& s, std::istream& is)
|
||||||
{
|
{
|
||||||
s.erase();
|
s.erase();
|
||||||
|
if(is.bad()) return;
|
||||||
s.reserve(is.rdbuf()->in_avail());
|
s.reserve(is.rdbuf()->in_avail());
|
||||||
char c;
|
char c;
|
||||||
while(is.get(c))
|
while(is.get(c))
|
||||||
|
@ -71,6 +71,7 @@ bool regex_callback(const boost::match_results<std::string::const_iterator>& wha
|
|||||||
void load_file(std::string& s, std::istream& is)
|
void load_file(std::string& s, std::istream& is)
|
||||||
{
|
{
|
||||||
s.erase();
|
s.erase();
|
||||||
|
if(is.bad()) return;
|
||||||
s.reserve(is.rdbuf()->in_avail());
|
s.reserve(is.rdbuf()->in_avail());
|
||||||
char c;
|
char c;
|
||||||
while(is.get(c))
|
while(is.get(c))
|
||||||
|
@ -41,6 +41,7 @@ extern const char* footer_text;
|
|||||||
void load_file(std::string& s, std::istream& is)
|
void load_file(std::string& s, std::istream& is)
|
||||||
{
|
{
|
||||||
s.erase();
|
s.erase();
|
||||||
|
if(is.bad()) return;
|
||||||
s.reserve(is.rdbuf()->in_avail());
|
s.reserve(is.rdbuf()->in_avail());
|
||||||
char c;
|
char c;
|
||||||
while(is.get(c))
|
while(is.get(c))
|
||||||
|
@ -41,6 +41,7 @@ extern const char* footer_text;
|
|||||||
void load_file(std::string& s, std::istream& is)
|
void load_file(std::string& s, std::istream& is)
|
||||||
{
|
{
|
||||||
s.erase();
|
s.erase();
|
||||||
|
if(is.bad()) return;
|
||||||
s.reserve(is.rdbuf()->in_avail());
|
s.reserve(is.rdbuf()->in_avail());
|
||||||
char c;
|
char c;
|
||||||
while(is.get(c))
|
while(is.get(c))
|
||||||
|
@ -84,6 +84,7 @@ using namespace std;
|
|||||||
void load_file(std::string& s, std::istream& is)
|
void load_file(std::string& s, std::istream& is)
|
||||||
{
|
{
|
||||||
s.erase();
|
s.erase();
|
||||||
|
if(is.bad()) return;
|
||||||
s.reserve(is.rdbuf()->in_avail());
|
s.reserve(is.rdbuf()->in_avail());
|
||||||
char c;
|
char c;
|
||||||
while(is.get(c))
|
while(is.get(c))
|
||||||
|
@ -29,6 +29,7 @@ boost::regex e("<\\s*A\\s+[^>]*href\\s*=\\s*\"([^\"]*)\"",
|
|||||||
void load_file(std::string& s, std::istream& is)
|
void load_file(std::string& s, std::istream& is)
|
||||||
{
|
{
|
||||||
s.erase();
|
s.erase();
|
||||||
|
if(is.bad()) return;
|
||||||
//
|
//
|
||||||
// attempt to grow string buffer to match file size,
|
// attempt to grow string buffer to match file size,
|
||||||
// this doesn't always work...
|
// this doesn't always work...
|
||||||
|
@ -28,6 +28,7 @@ boost::regex e("<\\s*A\\s+[^>]*href\\s*=\\s*\"([^\"]*)\"",
|
|||||||
void load_file(std::string& s, std::istream& is)
|
void load_file(std::string& s, std::istream& is)
|
||||||
{
|
{
|
||||||
s.erase();
|
s.erase();
|
||||||
|
if(is.bad()) return;
|
||||||
//
|
//
|
||||||
// attempt to grow string buffer to match file size,
|
// attempt to grow string buffer to match file size,
|
||||||
// this doesn't always work...
|
// this doesn't always work...
|
||||||
|
Reference in New Issue
Block a user