1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-13 13:17:36 +03:00

Remove redundant size check

The condition size > UINT_MAX - 10 is already checked earlier, so the
check is always false.
This commit is contained in:
Niels Dossche 2023-11-02 13:57:54 +01:00 committed by Nick Wellnhofer
parent fbea03f3d0
commit 6053f1ff54

6
tree.c
View File

@ -7348,7 +7348,7 @@ xmlBufferResize(xmlBufferPtr buf, unsigned int size)
case XML_BUFFER_ALLOC_DOUBLEIT: case XML_BUFFER_ALLOC_DOUBLEIT:
/*take care of empty case*/ /*take care of empty case*/
if (buf->size == 0) if (buf->size == 0)
newSize = (size > UINT_MAX - 10 ? UINT_MAX : size + 10); newSize = size + 10;
else else
newSize = buf->size; newSize = buf->size;
while (size > newSize) { while (size > newSize) {
@ -7358,7 +7358,7 @@ xmlBufferResize(xmlBufferPtr buf, unsigned int size)
} }
break; break;
case XML_BUFFER_ALLOC_EXACT: case XML_BUFFER_ALLOC_EXACT:
newSize = (size > UINT_MAX - 10 ? UINT_MAX : size + 10); newSize = size + 10;
break; break;
case XML_BUFFER_ALLOC_HYBRID: case XML_BUFFER_ALLOC_HYBRID:
if (buf->use < BASE_BUFFER_SIZE) if (buf->use < BASE_BUFFER_SIZE)
@ -7374,7 +7374,7 @@ xmlBufferResize(xmlBufferPtr buf, unsigned int size)
break; break;
default: default:
newSize = (size > UINT_MAX - 10 ? UINT_MAX : size + 10); newSize = size + 10;
break; break;
} }