Avoid undefined behavior when computing larger blockSize. The compiler might reason that (end - start)*2 is negative only if (end - start) is negative, see https://godbolt.org/g/wVEoTM
This commit is contained in:
parent
e375ac8478
commit
5c9cc0eed8
@ -6286,7 +6286,7 @@ poolGrow(STRING_POOL *pool)
|
||||
}
|
||||
if (pool->blocks && pool->start == pool->blocks->s) {
|
||||
BLOCK *temp;
|
||||
int blockSize = (int)(pool->end - pool->start)*2;
|
||||
int blockSize = (int)((unsigned)(pool->end - pool->start)*2U);
|
||||
|
||||
if (blockSize < 0)
|
||||
return XML_FALSE;
|
||||
|
Loading…
Reference in New Issue
Block a user