mirror of
https://github.com/opencv/opencv.git
synced 2024-11-29 05:29:54 +08:00
Fix a bad free space check in icvGrowSeq.
A difference of two pointers was casted to unsigned which can lead to overflow on 64-bit systems.
This commit is contained in:
parent
29e7eb7719
commit
8755ffbf31
@ -645,7 +645,7 @@ icvGrowSeq( CvSeq *seq, int in_front_of )
|
|||||||
/* If there is a free space just after last allocated block
|
/* If there is a free space just after last allocated block
|
||||||
and it is big enough then enlarge the last block.
|
and it is big enough then enlarge the last block.
|
||||||
This can happen only if the new block is added to the end of sequence: */
|
This can happen only if the new block is added to the end of sequence: */
|
||||||
if( (unsigned)(ICV_FREE_PTR(storage) - seq->block_max) < CV_STRUCT_ALIGN &&
|
if( (size_t)(ICV_FREE_PTR(storage) - seq->block_max) < CV_STRUCT_ALIGN &&
|
||||||
storage->free_space >= seq->elem_size && !in_front_of )
|
storage->free_space >= seq->elem_size && !in_front_of )
|
||||||
{
|
{
|
||||||
int delta = storage->free_space / elem_size;
|
int delta = storage->free_space / elem_size;
|
||||||
|
Loading…
Reference in New Issue
Block a user