Buffer overflow in vtkJPEGWriter when writing to memory
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
Inside vtkJPEGWriter::Write method the value of InternalFileName variable is determined depending on FileName, FilePrefix and FilePattern variables using sprintf function.
For instance, vtkJPEGWriter has FileName = NULL, FilePrefix = NULL and FilePattern = "%s.%d by default. If WriteToMemory flag is set, the InternalFileName will be computed using the following line:
sprintf(this->InternalFileName, this->FilePattern,this->FileNumber);
which will cause the buffer oferflow.