1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

core(persistence): add more checks for implementation limitations

This commit is contained in:
Alexander Alekhin
2019-11-07 14:01:51 +03:00
parent 417034518c
commit f42d5399aa
2 changed files with 12 additions and 2 deletions
+8
View File
@@ -578,10 +578,14 @@ public:
sz = (int)(ptr - beg);
if( sz > 0 )
{
if (i + sz >= CV_FS_MAX_LEN)
CV_PARSE_ERROR_CPP("string is too long");
memcpy(buf + i, beg, sz);
i += sz;
}
ptr++;
if (i + 1 >= CV_FS_MAX_LEN)
CV_PARSE_ERROR_CPP("string is too long");
switch ( *ptr )
{
case '\\':
@@ -605,6 +609,8 @@ public:
sz = (int)(ptr - beg);
if( sz > 0 )
{
if (i + sz >= CV_FS_MAX_LEN)
CV_PARSE_ERROR_CPP("string is too long");
memcpy(buf + i, beg, sz);
i += sz;
}
@@ -620,6 +626,8 @@ public:
sz = (int)(ptr - beg);
if( sz > 0 )
{
if (i + sz >= CV_FS_MAX_LEN)
CV_PARSE_ERROR_CPP("string is too long");
memcpy(buf + i, beg, sz);
i += sz;
}