changed the type of "header" in PlyFile from char [4096] to std::string to avoid buffer overrun on loading plys with veeery long comments
This commit is contained in:
parent
6a876e1fc9
commit
90c3924a77
|
@ -1059,7 +1059,8 @@ int PlyFile::OpenRead( const char * filename )
|
|||
goto error;
|
||||
}
|
||||
|
||||
header[0] = 0;
|
||||
header.clear();
|
||||
header.reserve(1536);
|
||||
|
||||
// ********* Parsing header ***********
|
||||
|
||||
|
@ -1069,7 +1070,8 @@ int PlyFile::OpenRead( const char * filename )
|
|||
error = E_UNESPECTEDEOF;
|
||||
goto error;
|
||||
}
|
||||
strcat(header,buf);
|
||||
header.append(buf);
|
||||
|
||||
if( strncmp(buf,HEADER,strlen(HEADER)) )
|
||||
{
|
||||
error = E_NOTHEADER;
|
||||
|
@ -1084,7 +1086,8 @@ int PlyFile::OpenRead( const char * filename )
|
|||
error = E_UNESPECTEDEOF;
|
||||
goto error;
|
||||
}
|
||||
strcat(header,buf);
|
||||
header.append(buf);
|
||||
|
||||
token = strtok(buf,SEP);
|
||||
if(token==0)
|
||||
{
|
||||
|
@ -1131,7 +1134,7 @@ int PlyFile::OpenRead( const char * filename )
|
|||
error = E_UNESPECTEDEOF;
|
||||
goto error;
|
||||
}
|
||||
strcat(header,buf);
|
||||
header.append(buf);
|
||||
|
||||
token = strtok(buf,SEP);
|
||||
if(token==0)
|
||||
|
|
|
@ -300,7 +300,7 @@ public:
|
|||
static const char * typenames[9];
|
||||
static const char * newtypenames[9];
|
||||
|
||||
inline const char * GetHeader() const { return header; }
|
||||
inline const char * GetHeader() const { return header.c_str(); }
|
||||
protected:
|
||||
|
||||
GZFILE gzfp;
|
||||
|
@ -309,7 +309,7 @@ protected:
|
|||
int error; // Errore corrente (vedi enum)
|
||||
int format; // Formato del file (vedi enum )
|
||||
|
||||
char header[4096]; // Testo dell'header
|
||||
std::string header; // Testo dell'header
|
||||
|
||||
PlyElement * cure; // Elemento da leggere
|
||||
|
||||
|
|
Loading…
Reference in New Issue