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
b6bc23c9b4
commit
6a3374989c
@ -6264,7 +6264,7 @@ poolGrow(STRING_POOL *pool)
|
|||||||
}
|
}
|
||||||
if (pool->blocks && pool->start == pool->blocks->s) {
|
if (pool->blocks && pool->start == pool->blocks->s) {
|
||||||
BLOCK *temp;
|
BLOCK *temp;
|
||||||
int blockSize = (int)(pool->end - pool->start)*2;
|
int blockSize = (int)((unsigned)(pool->end - pool->start)*2U);
|
||||||
|
|
||||||
if (blockSize < 0)
|
if (blockSize < 0)
|
||||||
return XML_FALSE;
|
return XML_FALSE;
|
||||||
|
Loading…
Reference in New Issue
Block a user