videoio: images: fix buffer overflow problem

This commit is contained in:
Alexander Alekhin 2016-12-01 15:24:36 +03:00
parent e4985f604a
commit c560ff23ad

View File

@ -345,7 +345,10 @@ bool CvVideoWriter_Images::writeFrame( const IplImage* image )
{ {
char str[_MAX_PATH]; char str[_MAX_PATH];
sprintf(str, filename, currentframe); sprintf(str, filename, currentframe);
int ret = cvSaveImage(str, image, &params[0]); std::vector<int> image_params = params;
image_params.push_back(0); // append parameters 'stop' mark
image_params.push_back(0);
int ret = cvSaveImage(str, image, &image_params[0]);
currentframe++; currentframe++;