]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Make sure that string buffers for cost arrays are large enough.
authorJosef Weidendorfer <Josef.Weidendorfer@gmx.de>
Mon, 4 Oct 2010 19:17:21 +0000 (19:17 +0000)
committerJosef Weidendorfer <Josef.Weidendorfer@gmx.de>
Mon, 4 Oct 2010 19:17:21 +0000 (19:17 +0000)
17 64bit values fit into 512 bytes (but not 256...).

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11393

callgrind/dump.c
callgrind/global.h
callgrind/main.c

index 5c04e90bfa248be7183a75d8090480921fbb23a7..9bfaaab8046ffb4f9f651388a13f44b5106be681 100644 (file)
@@ -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)
 {
index f83c39cedebe64921e44734fba67c0f7a175c942..bfb5a48168cf7a31e604bd98e61add5d5ee2d766 100644 (file)
@@ -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
index 2dd7e18a99b85d79405912fc4b4a8eb5a052088b..4223ddf7244035f9e4513e4ce38dcafa44254bd0 100644 (file)
@@ -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;