diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-12-16 23:52:28 +0100 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-12-16 23:57:12 +0100 |
commit | cde7c781e172c1fd55f74550b66712540a677d85 (patch) | |
tree | 74d820cb6ca3e38d09077059e0346260b3534865 /kern | |
parent | 1bb1ba65cb9efceeb20b4296f903f3fe58b3341e (diff) |
kern: gracefully handle bogus sample pc sequence number
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.
Diffstat (limited to 'kern')
-rw-r--r-- | kern/pc_sample.c | 3 |
1 files changed, 3 insertions, 0 deletions
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. |