Commit 7d8f1dde authored by Alexander Alekhin's avatar Alexander Alekhin

core(persistence): disable checks for base64 streams

parent f4c4b014
...@@ -59,14 +59,14 @@ char* icvGets( CvFileStorage* fs, char* str, int maxCount ) ...@@ -59,14 +59,14 @@ char* icvGets( CvFileStorage* fs, char* str, int maxCount )
} }
str[j++] = '\0'; str[j++] = '\0';
fs->strbufpos = i; fs->strbufpos = i;
if (maxCount > 256) if (maxCount > 256 && !(fs->flags & cv::FileStorage::BASE64))
CV_Assert(j < maxCount - 1 && "OpenCV persistence doesn't support very long lines"); CV_Assert(j < maxCount - 1 && "OpenCV persistence doesn't support very long lines");
return j > 1 ? str : 0; return j > 1 ? str : 0;
} }
if( fs->file ) if( fs->file )
{ {
char* ptr = fgets( str, maxCount, fs->file ); char* ptr = fgets( str, maxCount, fs->file );
if (ptr && maxCount > 256) if (ptr && maxCount > 256 && !(fs->flags & cv::FileStorage::BASE64))
{ {
size_t sz = strnlen(ptr, maxCount); size_t sz = strnlen(ptr, maxCount);
CV_Assert(sz < (size_t)(maxCount - 1) && "OpenCV persistence doesn't support very long lines"); CV_Assert(sz < (size_t)(maxCount - 1) && "OpenCV persistence doesn't support very long lines");
...@@ -77,7 +77,7 @@ char* icvGets( CvFileStorage* fs, char* str, int maxCount ) ...@@ -77,7 +77,7 @@ char* icvGets( CvFileStorage* fs, char* str, int maxCount )
if( fs->gzfile ) if( fs->gzfile )
{ {
char* ptr = gzgets( fs->gzfile, str, maxCount ); char* ptr = gzgets( fs->gzfile, str, maxCount );
if (ptr && maxCount > 256) if (ptr && maxCount > 256 && !(fs->flags & cv::FileStorage::BASE64))
{ {
size_t sz = strnlen(ptr, maxCount); size_t sz = strnlen(ptr, maxCount);
CV_Assert(sz < (size_t)(maxCount - 1) && "OpenCV persistence doesn't support very long lines"); CV_Assert(sz < (size_t)(maxCount - 1) && "OpenCV persistence doesn't support very long lines");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment