From: Igor Sysoev Date: Sun, 25 Sep 2016 07:54:51 +0000 (+0300) Subject: A fix of possible sign extension overflow, X-Git-Tag: 0.1.3~10 X-Git-Url: http://git.kaiwu.me/postgresql/log/contrib/postgres_fdw/static/gitweb.js?a=commitdiff_plain;h=7f48cb228828adc063f45505848940cc82036938;p=njs.git A fix of possible sign extension overflow, the issue has been found by Coverity Scan. --- diff --git a/nxt/nxt_array.c b/nxt/nxt_array.c index 9f1da8af..f9c3e89c 100644 --- a/nxt/nxt_array.c +++ b/nxt/nxt_array.c @@ -113,7 +113,7 @@ nxt_array_add_multiple(nxt_array_t *array, const nxt_mem_proto_t *proto, old = array->start; array->start = start; - memcpy(start, old, array->items * array->item_size); + memcpy(start, old, (uint32_t) array->items * array->item_size); if (array->separate == 0) { array->separate = 1; @@ -123,7 +123,7 @@ nxt_array_add_multiple(nxt_array_t *array, const nxt_mem_proto_t *proto, } } - item = (char *) array->start + array->items * array->item_size; + item = (char *) array->start + (uint32_t) array->items * array->item_size; array->items = items;