We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.
memmove may move very long buffer in TextureAtlas::insertQuad
memmove may move very long buffer in TextureAtlas::insertQuad
Bug #4043 [Closed]
Redmine issue system is closed, we are using github issue system instead.
This issue was moved to https://github.com/cocos2d/cocos2d-x/issues/8341
Status: | Closed | |
---|---|---|
Start date: | 2014-02-15 | |
Priority: | Low | |
Due date: | ||
Assignee: | - | |
% Done: | 0% |
|
Category: | - | |
Target version: | - |
unsigned int remaining = (_totalQuads-1) - index;
if( remaining > 0) {
memmove( &_quads[index+1], &_quads[index], sizeof(_quads[0]) * remaining );
}
remaining should define as int or long, or when ((_totalQuads-1) - index) less than 0, remaining may be very big int value, because of type of unsigned int. then result memmove move very long buffer.
file: CCTextureAtlas.cpp
function:
void TextureAtlas::insertQuad(V3F_C4B_T2F_Quad *quad, long index)
{
CCASSERT( index>=0 && index<_capacity, "insertQuadWithTexture: Invalid index");
}