assert() doesn't throw an exception, it just immediately crashes the

app, and DISSECTOR_ASSERT() throws an exception, but claims the problem
is a dissector bug, not a malformed packet.  Presumably the error in
question is the result of a malformed packet, so throw
ReportedBoundsError to indicate that (it's not really the *right*
exception, but the right exception doesn't exist).

svn path=/trunk/; revision=30776
This commit is contained in:
Guy Harris 2009-10-31 08:31:21 +00:00
parent 134e77034e
commit c9b5bc30d0
1 changed files with 2 additions and 1 deletions

View File

@ -215,7 +215,8 @@ tvbuff_t *new_octet_aligned_subset_bits(tvbuff_t *tvb, guint32 boffset, asn1_ctx
* We check now to ensure we don't cause g_malloc() to abort because
* we asked for entirely too much memory.
*/
assert(new_length <= check_length);
if (new_length > check_length)
THROW(ReportedBoundsError); /* indicate that the packet is malformed */
tvb_ensure_bytes_exist(tvb, offset, check_length);
buf = g_malloc(new_length);