From: Florian Krohm Date: Sun, 9 Nov 2014 21:57:23 +0000 (+0000) Subject: Fix a bug spotted by IBM's BEAM checker in VG_(describe_IP). X-Git-Tag: svn/VALGRIND_3_11_0~841 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=479e0e5b54d3280d232a0707d000a9e898c1a4b5;p=thirdparty%2Fvalgrind.git Fix a bug spotted by IBM's BEAM checker in VG_(describe_IP). In the non-XML part buf_dirname was read without observing the know_dirinfo guard. Now fixed. Initialise buf_dirname nevertheless. Also remove a dead assignment. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14707 --- diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c index 20ae401e7f..11e2037ec5 100644 --- a/coregrind/m_debuginfo/debuginfo.c +++ b/coregrind/m_debuginfo/debuginfo.c @@ -2224,7 +2224,7 @@ const HChar* VG_(describe_IP)(Addr eip, const InlIPCursor *iipc) const HChar *buf_srcloc; const HChar *buf_dirname; - Bool know_dirinfo = False; + Bool know_dirinfo; Bool know_fnname; Bool know_objname; Bool know_srcloc; @@ -2268,6 +2268,7 @@ const HChar* VG_(describe_IP)(Addr eip, const InlIPCursor *iipc) vg_assert (cur_inl); know_dirinfo = False; + buf_dirname = ""; // The fndn_ix and lineno for the caller of the inlined fn is in cur_inl. if (cur_inl->fndn_ix == 0) { buf_srcloc = "???"; @@ -2352,7 +2353,7 @@ const HChar* VG_(describe_IP)(Addr eip, const InlIPCursor *iipc) APPEND(" ("); // Get the directory name, if any, possibly pruned, into dirname. const HChar* dirname = NULL; - if (VG_(sizeXA)(VG_(clo_fullpath_after)) > 0) { + if (know_dirinfo && VG_(sizeXA)(VG_(clo_fullpath_after)) > 0) { Int i; dirname = buf_dirname; // Remove leading prefixes from the dirname.