--- a/test/buffer_tests.c Fri Nov 18 15:33:58 2016 +0100 +++ b/test/buffer_tests.c Fri Dec 16 23:22:18 2016 +0100 @@ -27,6 +27,7 @@ */ #include "buffer_tests.h" +#include <stdint.h> UCX_TEST(test_ucx_buffer_new) { UcxBuffer *b = ucx_buffer_new(NULL, 16, UCX_BUFFER_AUTOEXTEND); @@ -97,8 +98,12 @@ "failed seek shall leave pos unchanged"); b->pos = 0; - b->size = sizemax / 2 + 32; - off_t bigoff = sizemax / 2 - 16; + b->size = (sizemax >> 1) + 32; + + // we don't want to risk overflows in implicit constant casts + const size_t bigoff_comp = (sizemax >> 1) - 16; + off_t bigoff = (off_t)bigoff_comp; + r = ucx_buffer_seek(b, -bigoff, SEEK_CUR); UCX_TEST_ASSERT(r != 0, "seek cur underflow"); UCX_TEST_ASSERT(b->pos == 0,