diff options
author | krj <krj@f5534014-38df-0310-8fa8-9805f1628bb7> | 2009-08-11 18:16:55 +0000 |
---|---|---|
committer | krj <krj@f5534014-38df-0310-8fa8-9805f1628bb7> | 2009-08-11 18:16:55 +0000 |
commit | dd534b20f6ca78c2b1b2f7de801a40b9cddad899 (patch) | |
tree | 5c040f5e5b7f3a153be6e278ef15b06df34ff01a /epan/tvbuff.c | |
parent | 4bd7148627656016f90950da81ad4479dfbab318 (diff) |
Turn a comment in fast_ensure_contiguous() into a DISSECTOR_ASSERT() to make the implied requirement explicit.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@29381 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/tvbuff.c')
-rw-r--r-- | epan/tvbuff.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/epan/tvbuff.c b/epan/tvbuff.c index 676cfe4f42..7e2ca93a65 100644 --- a/epan/tvbuff.c +++ b/epan/tvbuff.c @@ -870,6 +870,9 @@ fast_ensure_contiguous(tvbuff_t *tvb, gint offset, guint length) guint u_offset; DISSECTOR_ASSERT(tvb && tvb->initialized); + /* We don't check for overflow in this fast path so we only handle simple types */ + DISSECTOR_ASSERT(length <= 8); + if (offset < 0 || !tvb->real_data) { return ensure_contiguous(tvb, offset, length); } @@ -877,8 +880,6 @@ fast_ensure_contiguous(tvbuff_t *tvb, gint offset, guint length) u_offset = offset; end_offset = u_offset + length; - /* don't need to check for overflow because length <= 8 */ - if (end_offset <= tvb->length) { return tvb->real_data + u_offset; } @@ -888,7 +889,7 @@ fast_ensure_contiguous(tvbuff_t *tvb, gint offset, guint length) } THROW(BoundsError); /* not reached */ - return 0; + return NULL; } |