TS-4208: Cast to appropriate sized types to avoid overflow
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/de526598 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/de526598 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/de526598 Branch: refs/heads/master Commit: de5265986b51bf614493f4ddecd21fe53878785a Parents: 2a51477 Author: Phil Sorber <[email protected]> Authored: Mon Feb 15 19:31:03 2016 -0700 Committer: Phil Sorber <[email protected]> Committed: Mon Feb 15 21:37:08 2016 -0700 ---------------------------------------------------------------------- lib/ts/ink_queue.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/de526598/lib/ts/ink_queue.cc ---------------------------------------------------------------------- diff --git a/lib/ts/ink_queue.cc b/lib/ts/ink_queue.cc index 6786c1f..6a1f55d 100644 --- a/lib/ts/ink_queue.cc +++ b/lib/ts/ink_queue.cc @@ -445,8 +445,8 @@ ink_freelists_dump(FILE *f) fprintf(f, " %18" PRIu64 " | %18" PRIu64 " | %10u | memory/%s\n", (uint64_t)fll->fl->allocated * (uint64_t)fll->fl->type_size, (uint64_t)fll->fl->used * (uint64_t)fll->fl->type_size, fll->fl->type_size, fll->fl->name ? fll->fl->name : "<unknown>"); - total_allocated += fll->fl->allocated * fll->fl->type_size; - total_used += fll->fl->used * fll->fl->type_size; + total_allocated += (uint64_t)fll->fl->allocated * (uint64_t)fll->fl->type_size; + total_used += (uint64_t)fll->fl->used * (uint64_t)fll->fl->type_size; fll = fll->next; } fprintf(f, " %18" PRIu64 " | %18" PRIu64 " | | TOTAL\n", total_allocated, total_used);
