aboutsummaryrefslogtreecommitdiffstats
path: root/asn1
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-02-27 22:43:54 +0000
committerGuy Harris <guy@alum.mit.edu>2013-02-27 22:43:54 +0000
commit6b629c4d92a7223c4930d9b22be1d9e32c375303 (patch)
treefbdbf4b1f847b8388e365010ee64e04413507bd0 /asn1
parent97a0ad8eab5b236f33113858ec62f15f82775f76 (diff)
Move show_exception() and show_reported_bounds_error() to
epan/show_exception.c, as it's used outside epan/dissectors/packet-frame.c. Update their callers to include <epan/show_exception.h> to get their declaration. Add a CATCH_NONFATAL_ERRORS macro that catches all exceptions that, if there's more stuff in the packet to dissect after the dissector call that threw the exception, doesn't mean you shouldn't go ahead and dissect that stuff. Use it in all those cases, including ones where BoundsError was inappropriately being caught (you want those passed up to the top level, so that the packet is reported as having been cut short in the capture process). Add a CATCH_BOUNDS_ERRORS macro that catches all exceptions that correspond to running past the end of the data for a tvbuff; use it rather than explicitly catching those exceptions individually, and rather than just catching all exceptions (the only place that DissectorError should be caught, for example, is at the top level, so dissector bugs show up in the protocol tree). Don't catch and then immediately rethrow exceptions without doing anything else; just let the exceptions go up to the final catcher. Use show_exception() to report non-fatal errors, rather than doing it yourself. If a dissector is called from Lua, catch all non-fatal errors and use show_exception() to report them rather than catching only ReportedBoundsError and adding a proto_malformed item. Don't catch exceptions when constructing a trailer tvbuff in packet-ieee8023.c - just construct it after the payload has been dissected, and let whatever exceptions that throws be handled at the top level. Avoid some TRY/CATCH/ENDTRY cases by using checks such as tvb_bytes_exist() before even looking in the tvbuff. svn path=/trunk/; revision=47924
Diffstat (limited to 'asn1')
-rw-r--r--asn1/kerberos/packet-kerberos-template.c2
-rw-r--r--asn1/ldap/packet-ldap-template.c2
-rw-r--r--asn1/t124/packet-t124-template.c2
-rw-r--r--asn1/t125/packet-t125-template.c4
-rw-r--r--asn1/tcap/packet-tcap-template.c2
-rw-r--r--asn1/tcap/tcap.cnf7
6 files changed, 8 insertions, 11 deletions
diff --git a/asn1/kerberos/packet-kerberos-template.c b/asn1/kerberos/packet-kerberos-template.c
index bdbaad1bb0..814f8a83d1 100644
--- a/asn1/kerberos/packet-kerberos-template.c
+++ b/asn1/kerberos/packet-kerberos-template.c
@@ -1432,7 +1432,7 @@ dissect_kerberos_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
TRY {
offset=dissect_kerberos_Applications(FALSE, tvb, 0, &asn1_ctx , tree, /* hf_index */ -1);
- } CATCH_ALL {
+ } CATCH_BOUNDS_ERRORS {
pinfo->private_data=saved_private_data;
RETHROW;
} ENDTRY;
diff --git a/asn1/ldap/packet-ldap-template.c b/asn1/ldap/packet-ldap-template.c
index 328ffbbdbc..4c4d151de8 100644
--- a/asn1/ldap/packet-ldap-template.c
+++ b/asn1/ldap/packet-ldap-template.c
@@ -96,7 +96,7 @@
#include <epan/emem.h>
#include <epan/oids.h>
#include <epan/strutil.h>
-#include <epan/dissectors/packet-frame.h>
+#include <epan/show_exception.h>
#include <epan/dissectors/packet-tcp.h>
#include <epan/dissectors/packet-windows-common.h>
#include <epan/dissectors/packet-dcerpc.h>
diff --git a/asn1/t124/packet-t124-template.c b/asn1/t124/packet-t124-template.c
index 35ac9930cd..f0b5418901 100644
--- a/asn1/t124/packet-t124-template.c
+++ b/asn1/t124/packet-t124-template.c
@@ -163,7 +163,7 @@ dissect_t124_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, vo
*/
TRY {
(void) dissect_per_sequence(tvb, 0, &asn1_ctx, NULL, -1, -1, t124Heur_sequence);
- } CATCH2(BoundsError, ReportedBoundsError) {
+ } CATCH_BOUNDS_ERRORS {
failed = TRUE;
} ENDTRY;
diff --git a/asn1/t125/packet-t125-template.c b/asn1/t125/packet-t125-template.c
index 0d959c8685..f89555b224 100644
--- a/asn1/t125/packet-t125-template.c
+++ b/asn1/t125/packet-t125-template.c
@@ -109,7 +109,7 @@ dissect_t125_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, vo
TRY {
/* could be BER */
get_ber_identifier(tvb, 0, &ber_class, &pc, &tag);
- } CATCH2(BoundsError, ReportedBoundsError) {
+ } CATCH_BOUNDS_ERRORS {
failed = TRUE;
} ENDTRY;
@@ -126,7 +126,7 @@ dissect_t125_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, vo
dissect_per_constrained_integer(tvb, 0, &asn1_ctx,
NULL, hf_t125_heur, 0, 42,
&choice_index, FALSE);
- } CATCH2(BoundsError, ReportedBoundsError) {
+ } CATCH_BOUNDS_ERRORS {
failed = TRUE;
} ENDTRY;
diff --git a/asn1/tcap/packet-tcap-template.c b/asn1/tcap/packet-tcap-template.c
index ba0cebd0ed..b3de566382 100644
--- a/asn1/tcap/packet-tcap-template.c
+++ b/asn1/tcap/packet-tcap-template.c
@@ -33,11 +33,11 @@
#include <epan/oids.h>
#include <epan/asn1.h>
#include <epan/strutil.h>
+#include <epan/show_exception.h>
#include <string.h>
#include "packet-ber.h"
#include "packet-tcap.h"
-#include "packet-frame.h"
#include <epan/tcap-persistentdata.h>
#define PNAME "Transaction Capabilities Application Part"
diff --git a/asn1/tcap/tcap.cnf b/asn1/tcap/tcap.cnf
index ae28bd5839..c32c6ae20f 100644
--- a/asn1/tcap/tcap.cnf
+++ b/asn1/tcap/tcap.cnf
@@ -94,11 +94,8 @@ if (!next_tvb)
TRY {
%(DEFAULT_BODY)s
}
-CATCH(BoundsError) {
- RETHROW;
-}
-CATCH(ReportedBoundsError) {
- show_reported_bounds_error(tvb, actx->pinfo, tree);
+CATCH_NONFATAL_ERRORS {
+ show_exception(tvb, actx->pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
}
ENDTRY;