From: Julian Seward Date: Mon, 26 Mar 2007 15:23:20 +0000 (+0000) Subject: Add assertion + comment to a loop using VG_(getcwd). X-Git-Tag: svn/VALGRIND_3_3_0~306 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de95f789789a2821144502cec56978b0a84ee4af;p=thirdparty%2Fvalgrind.git Add assertion + comment to a loop using VG_(getcwd). git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6663 --- diff --git a/callgrind/dump.c b/callgrind/dump.c index 2904e96366..7172533b5f 100644 --- a/callgrind/dump.c +++ b/callgrind/dump.c @@ -1694,6 +1694,11 @@ void CLG_(init_dumps)() base_directory = 0; size *= 2; } + /* in fact, this loop could run forever (or at least till + CLG_MALLOC fails) if VG_(getcwd) returns False for any + reason other than the buffer is too small. So be + safe: */ + tl_assert( size < 100 * 200 ); } size = VG_(strlen)(base_directory) + VG_(strlen)(CLG_(clo).filename_base) +2;