bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH gnumach] kern: gracefully handle bogus sample pc sequence number


From: Justus Winter
Subject: [PATCH gnumach] kern: gracefully handle bogus sample pc sequence number
Date: Tue, 16 Dec 2014 23:58:09 +0100

If a sequence number larger than the sample control sequence number is
supplied, `nsamples' becomes negative.  Handle this gracefully.

* kern/pc_sample.c (get_sampled_pcs): Handle bogus sequence number.
---
 kern/pc_sample.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kern/pc_sample.c b/kern/pc_sample.c
index 81b2056..fcb9d71 100644
--- a/kern/pc_sample.c
+++ b/kern/pc_sample.c
@@ -189,6 +189,9 @@ get_sampled_pcs(
                   (sampled_pc_array_t)cp->buffer,
                   (seqidx2 + 1) * sizeof(sampled_pc_t));
        }
+    } else if (nsamples < 0) {
+       /* Bogus SEQNO supplied.  */
+       nsamples = 0;
     } else {
        /*  could either be zero because of overflow, or because
         *  we are being lied to.  In either case, return nothing.
-- 
2.1.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]