# HG changeset patch # User Olaf Wintermann # Date 1488212736 -3600 # Node ID 1634c3ea89dae9ac332dd9ce14fd3b20001ad89f # Parent 27b31c2c959c1dec54a7aac25583a8c21824869f fixes integer overflow in ucx_buffer_extract diff -r 27b31c2c959c -r 1634c3ea89da ucx/buffer.c --- a/ucx/buffer.c Mon Feb 27 11:45:31 2017 +0100 +++ b/ucx/buffer.c Mon Feb 27 17:25:36 2017 +0100 @@ -64,8 +64,9 @@ UcxBuffer* ucx_buffer_extract( UcxBuffer *src, size_t start, size_t length, int flags) { - - if (src->size == 0 || length == 0 || start+length > src->capacity) { + if (src->size == 0 || length == 0 || + ((size_t)-1) - start < length || start+length > src->capacity) + { return NULL; }