From c9b5bc30d0a68dd74941f003a7a9bafb1c540a56 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sat, 31 Oct 2009 08:31:21 +0000 Subject: [PATCH] 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 --- epan/dissectors/packet-per.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/epan/dissectors/packet-per.c b/epan/dissectors/packet-per.c index dc4580f3e1..1a77cb7ab1 100644 --- a/epan/dissectors/packet-per.c +++ b/epan/dissectors/packet-per.c @@ -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);