|
From: <sv...@va...> - 2010-10-04 19:17:30
|
Author: weidendo
Date: 2010-10-04 20:17:21 +0100 (Mon, 04 Oct 2010)
New Revision: 11393
Log:
Make sure that string buffers for cost arrays are large enough.
17 64bit values fit into 512 bytes (but not 256...).
Modified:
trunk/callgrind/dump.c
trunk/callgrind/global.h
trunk/callgrind/main.c
Modified: trunk/callgrind/dump.c
===================================================================
--- trunk/callgrind/dump.c 2010-10-03 12:35:03 UTC (rev 11392)
+++ trunk/callgrind/dump.c 2010-10-04 19:17:21 UTC (rev 11393)
@@ -55,7 +55,7 @@
* 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)
{
Modified: trunk/callgrind/global.h
===================================================================
--- trunk/callgrind/global.h 2010-10-03 12:35:03 UTC (rev 11392)
+++ trunk/callgrind/global.h 2010-10-04 19:17:21 UTC (rev 11393)
@@ -118,6 +118,7 @@
#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
Modified: trunk/callgrind/main.c
===================================================================
--- trunk/callgrind/main.c 2010-10-03 12:35:03 UTC (rev 11392)
+++ trunk/callgrind/main.c 2010-10-04 19:17:21 UTC (rev 11393)
@@ -1519,7 +1519,7 @@
static
void finish(void)
{
- Char buf[RESULTS_BUF_LEN], fmt[128];
+ Char buf[32+COSTS_LEN], fmt[128];
Int l1, l2, l3;
FullCost total;
|