Don't produce suppression stack pseudo-traces with more than
VG_MAX_SUPP_CALLERS entries in them.  Fixes #255822.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11515 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c
index 96638e5..d043747 100644
--- a/coregrind/m_errormgr.c
+++ b/coregrind/m_errormgr.c
@@ -376,10 +376,14 @@
       VG_(xaprintf)(text, "   %s\n", xtra);
 
    // Print stack trace elements
+   UInt n_ips = VG_(get_ExeContext_n_ips)(ec);
+   tl_assert(n_ips > 0);
+   if (n_ips > VG_MAX_SUPP_CALLERS)
+      n_ips = VG_MAX_SUPP_CALLERS;
    VG_(apply_StackTrace)(printSuppForIp_nonXML,
                          text,
                          VG_(get_ExeContext_StackTrace)(ec),
-                         VG_(get_ExeContext_n_ips)(ec));
+                         n_ips);
 
    VG_(xaprintf)(text, "}\n");
    // zero terminate