1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

Merge pull request #12391 from DEEPIR:master

fix some errors found by static analyzer. (#12391)

* fix possible divided by zero and by negative values

* only 4 elements are used in these arrays

* fix uninitialized member

* use boolean type for semantic boolean variables

* avoid invalid array index

* to avoid exception and because base64_beg is only used in this block

* use std::atomic<bool> to avoid thread control race condition
This commit is contained in:
cyy
2018-09-04 21:39:19 +08:00
committed by Alexander Alekhin
parent f826709452
commit 10fb88d027
9 changed files with 12 additions and 13 deletions
+2 -2
View File
@@ -238,11 +238,11 @@ static char* icvJSONParseValue( CvFileStorage* fs, char* ptr, CvFileNode* node )
CV_PARSE_ERROR("Invalid `dt` in Base64 header");
}
/* set base64_beg to beginning of base64 data */
base64_beg = &base64_buffer.at( base64::ENCODED_HEADER_SIZE );
if ( base64_buffer.size() > base64::ENCODED_HEADER_SIZE )
{
/* set base64_beg to beginning of base64 data */
base64_beg = &base64_buffer.at( base64::ENCODED_HEADER_SIZE );
if ( !base64::base64_valid( base64_beg, 0U, base64_end - base64_beg ) )
CV_PARSE_ERROR( "Invalid Base64 data." );