summaryrefslogtreecommitdiff
path: root/epan/tvbtest.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-04-18 19:22:24 +0000
committerGuy Harris <guy@alum.mit.edu>2013-04-18 19:22:24 +0000
commitc0c15029ed8d1234c95a71fdf7510a8bf0964fcb (patch)
tree585d3be4be77a93eb5fed23814d87ced468e9df9 /epan/tvbtest.c
parentd89d6c8314b8a5c407f86fe0f6e029b4da582b43 (diff)
downloadwireshark-c0c15029ed8d1234c95a71fdf7510a8bf0964fcb.tar.gz
Add to tvbuffs a "fragment length" field; if the tvbuff represents the
first fragment of a non-reassembled packet, and we know the length the packet would have if it were reassembled, this field holds the length of the fragment, and the "reported length" field shows the length the packet would have if it were reassembled, so going past the end of the fragment but staying within the length of the reassembled packet can be reported as "dissection would have worked if the packet had been reassembled" rather than "the packet is too short, so it was probably malformed". Add a FragmentBoundsError exception, thrown in the "dissection would have worked if the packet had been reassembled" case. Add a new tvb_new_subset_length_fragment() routine to create a new subset tvb with specified fragment and reported lengths. Use it in the CLNP dissector. Add some more sanity checks in the CLNP dissector. svn path=/trunk/; revision=48917
Diffstat (limited to 'epan/tvbtest.c')
-rw-r--r--epan/tvbtest.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/epan/tvbtest.c b/epan/tvbtest.c
index 94b91d2dc3..2aa6b187f1 100644
--- a/epan/tvbtest.c
+++ b/epan/tvbtest.c
@@ -73,9 +73,15 @@ test(tvbuff_t *tvb, gchar* name,
CATCH(BoundsError) {
ex_thrown = TRUE;
}
+ CATCH(FragmentBoundsError) {
+ printf("02: Caught wrong exception: FragmentBoundsError\n");
+ }
CATCH(ReportedBoundsError) {
printf("02: Caught wrong exception: ReportedBoundsError\n");
}
+ CATCH_ALL {
+ printf("02: Caught wrong exception: %lu, exc->except_id.except_code\n");
+ }
ENDTRY;
if (!ex_thrown) {
@@ -94,9 +100,15 @@ test(tvbuff_t *tvb, gchar* name,
CATCH(BoundsError) {
printf("03: Caught wrong exception: BoundsError\n");
}
+ CATCH(FragmentBoundsError) {
+ printf("03: Caught wrong exception: FragmentBoundsError\n");
+ }
CATCH(ReportedBoundsError) {
ex_thrown = TRUE;
}
+ CATCH_ALL {
+ printf("02: Caught wrong exception: %lu, exc->except_id.except_code\n");
+ }
ENDTRY;
if (!ex_thrown) {
@@ -114,9 +126,15 @@ test(tvbuff_t *tvb, gchar* name,
CATCH(BoundsError) {
ex_thrown = TRUE;
}
+ CATCH(FragmentBoundsError) {
+ printf("04: Caught wrong exception: FragmentBoundsError\n");
+ }
CATCH(ReportedBoundsError) {
printf("04: Caught wrong exception: ReportedBoundsError\n");
}
+ CATCH_ALL {
+ printf("02: Caught wrong exception: %lu, exc->except_id.except_code\n");
+ }
ENDTRY;
if (!ex_thrown) {
@@ -134,9 +152,15 @@ test(tvbuff_t *tvb, gchar* name,
CATCH(BoundsError) {
ex_thrown = TRUE;
}
+ CATCH(FragmentBoundsError) {
+ printf("05: Caught wrong exception: FragmentBoundsError\n");
+ }
CATCH(ReportedBoundsError) {
printf("05: Caught wrong exception: ReportedBoundsError\n");
}
+ CATCH_ALL {
+ printf("02: Caught wrong exception: %lu, exc->except_id.except_code\n");
+ }
ENDTRY;
if (ex_thrown) {
@@ -154,9 +178,15 @@ test(tvbuff_t *tvb, gchar* name,
CATCH(BoundsError) {
ex_thrown = TRUE;
}
+ CATCH(FragmentBoundsError) {
+ printf("06: Caught wrong exception: FragmentBoundsError\n");
+ }
CATCH(ReportedBoundsError) {
printf("06: Caught wrong exception: ReportedBoundsError\n");
}
+ CATCH_ALL {
+ printf("02: Caught wrong exception: %lu, exc->except_id.except_code\n");
+ }
ENDTRY;
if (ex_thrown) {