aboutsummaryrefslogtreecommitdiff
path: root/gprof/gmon_io.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>1999-09-24 09:03:49 +0000
committerNick Clifton <nickc@redhat.com>1999-09-24 09:03:49 +0000
commit2d35e9f64f547cb4fe7f97c69b4aca6bfad8f5f3 (patch)
tree9398b1425e72b428c34ba9c5384af32d19a375d7 /gprof/gmon_io.c
parentd3426803c579b3e53b702d95b11eff681d653209 (diff)
downloadgdb-2d35e9f64f547cb4fe7f97c69b4aca6bfad8f5f3.zip
gdb-2d35e9f64f547cb4fe7f97c69b4aca6bfad8f5f3.tar.gz
gdb-2d35e9f64f547cb4fe7f97c69b4aca6bfad8f5f3.tar.bz2
Make sure that sensible values are extracted from a raw header.
Diffstat (limited to 'gprof/gmon_io.c')
-rw-r--r--gprof/gmon_io.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gprof/gmon_io.c b/gprof/gmon_io.c
index 067323c..7e0a1a0 100644
--- a/gprof/gmon_io.c
+++ b/gprof/gmon_io.c
@@ -251,6 +251,15 @@ DEFUN (gmon_out_read, (filename), const char *filename)
printf ("[gmon_out_read] samp_bytes %d hist_num_bins %d\n",
samp_bytes, hist_num_bins));
+ /* Make sure that we have sensible values. */
+ if (samp_bytes < 0 || lowpc > highpc)
+ {
+ fprintf (stderr,
+ _("%s: file '%s' does not appear to be in gmon.out format\n"),
+ whoami, filename);
+ done (1);
+ }
+
if (hist_num_bins)
{
++nhist;