From: Josef Weidendorfer Date: Mon, 4 Oct 2010 19:17:21 +0000 (+0000) Subject: Make sure that string buffers for cost arrays are large enough. X-Git-Tag: svn/VALGRIND_3_6_0~64 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=540efd67184d388f508b9f86a244d10d4df91b7d;p=thirdparty%2Fvalgrind.git Make sure that string buffers for cost arrays are large enough. 17 64bit values fit into 512 bytes (but not 256...). git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11393 --- diff --git a/callgrind/dump.c b/callgrind/dump.c index 5c04e90bfa..9bfaaab804 100644 --- a/callgrind/dump.c +++ b/callgrind/dump.c @@ -55,7 +55,7 @@ EventMapping* CLG_(dumpmap) = 0; * print_fn_pos, fprint_apos, fprint_fcost, fprint_jcc, * fprint_fcc_ln, dump_run_info, dump_state_info */ -static Char outbuf[FILENAME_LEN + FN_NAME_LEN + OBJ_NAME_LEN]; +static Char outbuf[FILENAME_LEN + FN_NAME_LEN + OBJ_NAME_LEN + COSTS_LEN]; Int CLG_(get_dump_counter)(void) { diff --git a/callgrind/global.h b/callgrind/global.h index f83c39cede..bfb5a48168 100644 --- a/callgrind/global.h +++ b/callgrind/global.h @@ -118,6 +118,7 @@ struct _CommandLineOptions { #define FILENAME_LEN 256 #define FN_NAME_LEN 4096 /* for C++ code :-) */ #define OBJ_NAME_LEN 256 +#define COSTS_LEN 512 /* at least 17x 64bit values */ #define BUF_LEN 512 #define COMMIFY_BUF_LEN 128 #define RESULTS_BUF_LEN 256 diff --git a/callgrind/main.c b/callgrind/main.c index 2dd7e18a99..4223ddf724 100644 --- a/callgrind/main.c +++ b/callgrind/main.c @@ -1519,7 +1519,7 @@ void branchsim_printstat(int l1, int l2, int l3) static void finish(void) { - Char buf[RESULTS_BUF_LEN], fmt[128]; + Char buf[32+COSTS_LEN], fmt[128]; Int l1, l2, l3; FullCost total;