In common/vector/vector.c use GCC/Clang built-in overflow operators.

The first patch is a neutral change which adds comments.  The second
patch is the actual change.

Add a new header "checked-overflow.h" which has the purpose of
isolating the use of the built-ins to one file (in case we need to add
a new compiler later).  Then use this in generic_vector_reserve.

I tested this with GCC 11 and Clang 13.

I verified by disassembly that "jo" (jump overflow) / "jno" is used
where it was not used previously, by both compilers.

Rich.


_______________________________________________
Libguestfs mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/libguestfs

Reply via email to