From 7d8f1dde2655c8514a5b05b24ba225c49a6adc37 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Tue, 27 Mar 2018 17:02:04 +0300 Subject: [PATCH] core(persistence): disable checks for base64 streams --- modules/core/src/persistence.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/core/src/persistence.cpp b/modules/core/src/persistence.cpp index 0ec57a55f6..ae6fd3a423 100644 --- a/modules/core/src/persistence.cpp +++ b/modules/core/src/persistence.cpp @@ -59,14 +59,14 @@ char* icvGets( CvFileStorage* fs, char* str, int maxCount ) } str[j++] = '\0'; 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"); return j > 1 ? str : 0; } if( 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); 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 ) if( fs->gzfile ) { 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); CV_Assert(sz < (size_t)(maxCount - 1) && "OpenCV persistence doesn't support very long lines");