Turn a comment in fast_ensure_contiguous() into a DISSECTOR_ASSERT() to make the implied requirement explicit.

svn path=/trunk/; revision=29381
This commit is contained in:
Kovarththanan Rajaratnam 2009-08-11 18:16:55 +00:00
parent 261a8406bc
commit 158827a5e7
1 changed files with 4 additions and 3 deletions

View File

@ -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;
}