Commit Graph

22 Commits

Author SHA1 Message Date
Guy Harris 6b629c4d92 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
2013-02-27 22:43:54 +00:00
Bill Meier 357ea3fc88 Define variants of CLEANUP_PUSH & etc to allow nested use w/o "shadowing" variables.
svn path=/trunk/; revision=46366
2012-12-04 14:37:21 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Guy Harris 7d3051c949 Get rid of trailing white space.
svn path=/trunk/; revision=35277
2010-12-27 21:40:48 +00:00
Kovarththanan Rajaratnam 01abc372e6 Remove a non thread-safe usage (useful when/if we ever support threading) of a static tvbuff in tvb_new_real_data(). The current version uses a static 'last_tvb' to keep track of the last allocated tvbuff. This is needed because some of the function we call can throw an exception. This patch improves this strategy by throwing an exception (if needed) before we try to allocate the tvbuff. This way we avoid a memleak _and_ we don't have to track the 'last_tvb' tvbuff.
svn path=/trunk/; revision=29441
2009-08-16 07:29:11 +00:00
Stig Bjørlykke fce2aea785 Add standard file heading.
svn path=/trunk/; revision=28692
2009-06-11 10:07:57 +00:00
Bill Meier e23d9e48b8 Fix minor typo in comment
svn path=/trunk/; revision=25189
2008-04-28 20:32:06 +00:00
Luis Ontanon b46c4dd535 revert back to 20437
svn path=/trunk/; revision=21451
2007-04-16 23:15:03 +00:00
Luis Ontanon 96384817ec Make sure that when a windows exception is thrown ENDTRY gets evaluated.
fix for one of the various issues that cause bug 1334

svn path=/trunk/; revision=21332
2007-04-03 22:06:31 +00:00
Ulf Lamping e3330fd922 instead of simply doing an assert when running out of memory in emem, throw a new OutOfMemoryError Exception, so file.c can show at least a better explanation to the user before Wireshark terminates
XXX - to prevent a busy wait, I need a portable way to wait for a short time period, like Sleep() for Windows

svn path=/trunk/; revision=20437
2007-01-15 05:16:13 +00:00
Anders Broman 996d4db495 Ethereal->Wireshark
svn path=/trunk/; revision=18234
2006-05-28 19:49:07 +00:00
Ronnie Sahlberg edcaaee164 SCSI is fairly unique among the ethereal protocols in that it is sometimes normal for a PDU we receive back froma device to be truncated.
(report luns with allocation length 8 for example)

Therefore it is a bit wrong to mark these packets as [malformed packets]
Since they are truncated by scsi   and this is NOTY an error condition.


Add a new exception type  :  ScsiBoundsError
If this exception is caught by packet-frame, then print an appropriate message
instead of [malformed packet]

For SCSI, add helper macros TRY_SCSI_SHORT_PACKET   and END_...


If the packet was not short in the normal sense (snaplen < packetlen) then intercept the exception for BoundsError and rethrow it as ScsiBoundsError instead.





svn path=/trunk/; revision=17611
2006-03-13 10:29:00 +00:00
Guy Harris 84cf5472e9 If a dissector writer directly throws DissectorError, don't punish the
user by crashing due to a null pointer dereference, punish the dissector
writer by saying he or she didn't bother providing an explanation of the
error.

The exception message isn't a const string any more; make the
"exception_message" argument to "show_exception()" a "char *", not a
"const char *".

svn path=/trunk/; revision=15251
2005-08-06 21:38:43 +00:00
Guy Harris f618b54d36 Support throwing an exception with a null message pointer, and have the
message not be const (as we generate messages with "g_strdup_sprintf()",
which means they need to be freed; using a null message means that we
don't have to use a special string for exceptions with no message, and
don't have to worry about not freeing that).

Have THROW() throw an exception with a null message pointer.  (This
means that you crash if you throw DissectorError with THROW().  Don't do
that - it means you don't get a more detailed explanation of the
dissector problem.  Use the DISSECTOR_ASSERT, etc. macros in
epan/proto.h instead.)

Free the exception message for DissectorError, as it's mallocated.

svn path=/trunk/; revision=15250
2005-08-06 19:58:45 +00:00
Gilbert Ramirez c8cd8f21a4 Exception handling fixes, and a fix to packet-frame.c,
from Richard van der Hoff.

svn path=/trunk/; revision=15205
2005-08-04 13:54:46 +00:00
Guy Harris b9ba0508bc Explain the BoundsError and ReportedBoundsError errors a bit more, as
per Ulf Lamping's request.

svn path=/trunk/; revision=15193
2005-08-02 08:42:02 +00:00
Ulf Lamping e378098855 from Micheal Duigou: add some doxygen tags and some changes to README.developer
svn path=/trunk/; revision=13725
2005-03-11 21:14:38 +00:00
Guy Harris 2bdef3c122 Rename the FieldError exception to DissectorError.
Add a DISSECTOR_ASSERT() macro, which is the usual type of assertion
macro, but throws a DissectorError exception with a message giving the
flien and line number and the failed test as a string.  Use that macro
in "alloc_field_info()".

Report that exception in the Info column and the protocol tree, as well
as logging the exception failure with g_warning().

svn path=/trunk/; revision=13078
2005-01-16 23:30:55 +00:00
Ulf Lamping 1c9781b4ec throw the new FieldError exception, if a dissector tries to add a field with invalid parameters
add a message parameter to the show_exception function

svn path=/trunk/; revision=13074
2005-01-16 16:06:15 +00:00
Guy Harris b60dec2b52 Add a new EXCEPT_CODE macro to get the exception code for the current
exception, for use in CATCH_ALL handlers, so you can catch all
exceptions and then pass the exception code on to a routine that handles
different exceptions differently.

svn path=/trunk/; revision=8757
2003-10-23 04:59:46 +00:00
Gilbert Ramirez 8f1fff2e6a Create a more modular type system for the FT_* types. Put them
into epan/ftypes.

Re-write display filter routines using Lemon parser instead of yacc.
Besides using a different tool, the new grammar is much simpler, while
the display filter engine itself is more powerful and more easily extended.

Add dftest executable, to test display filter "bytecode" generation.
Add option to "configure" to build dftest or randpkt, both of which are not
built by default.

Implement Ed Warnicke's ideas about dranges in the new display filter and
ftype code.

Remove type FT_TEXT_ONLY in favor of FT_NONE, and have protocols registered
as FT_PROTOCOL. Thus, FT_NONE is used only for simple labels in the proto tree,
while FT_PROTOCOL is used for protocols. This was necessary for being
able to make byte slices (ranges) out of protocols, like "frame[0:3]"

Win32 Makefile.nmake's will be added tonight.

svn path=/trunk/; revision=2967
2001-02-01 20:21:25 +00:00
Gilbert Ramirez 83ec54675c First step in moving core Ethereal routines to libepan.
svn path=/trunk/; revision=2458
2000-09-27 04:55:05 +00:00