aboutsummaryrefslogtreecommitdiffstats
path: root/epan/exceptions.h
AgeCommit message (Collapse)AuthorFilesLines
2013-03-02Define a new exception for reassembly errors, and throw it in several casesEvan Huus1-2/+26
instead of using DISSECTOR_ASSERT. When a dissector passes bad data to the reassembly machine, that isn't necessarily the dissector's fault - the data may come straight from the packet, and the dissector may not have enough information to know it's bad without telling the reassembly machine in the first place. Also fix a bug in the reassembly machine. If it were given a fragment and all of the following conditions were met: - the other associated fragments were already marked as done (reassembled) - the fragment went beyond the end of the conceptual reassembled buffer - the dissector had not set the PARTIAL_REASSEMBLY flag then the reassembly machine would incorrectly think there was an overlap and run past the end of the already-reassembled buffer. Should fix the rest of https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8380 #BACKPORT This is probably too big and intrusive to backport directly, and parts of it will need adapting anyways since reassemble.c has changed. But the bug exists and crashes in 1.6 and 1.8, so we'll have to do something. svn path=/trunk/; revision=48011
2013-02-27Move show_exception() and show_reported_bounds_error() toGuy Harris1-10/+66
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
2012-12-04Define variants of CLEANUP_PUSH & etc to allow nested use w/o "shadowing" ↵Bill Meier1-0/+7
variables. svn path=/trunk/; revision=46366
2012-06-28Update Free Software Foundation address.Jakub Zawadzki1-1/+1
(COPYING will be updated in next commit) svn path=/trunk/; revision=43536
2010-12-27Get rid of trailing white space.Guy Harris1-7/+7
svn path=/trunk/; revision=35277
2009-08-16Remove a non thread-safe usage (useful when/if we ever support threading) of ↵Kovarththanan Rajaratnam1-0/+5
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-06-11Add standard file heading.Stig Bjørlykke1-4/+24
svn path=/trunk/; revision=28692
2008-04-28Fix minor typo in commentBill Meier1-1/+1
svn path=/trunk/; revision=25189
2007-04-16revert back to 20437Luis Ontanon1-17/+6
svn path=/trunk/; revision=21451
2007-04-03Make sure that when a windows exception is thrown ENDTRY gets evaluated.Luis Ontanon1-4/+17
fix for one of the various issues that cause bug 1334 svn path=/trunk/; revision=21332
2007-01-15instead of simply doing an assert when running out of memory in emem, throw ↵Ulf Lamping1-0/+6
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
2006-05-28Ethereal->WiresharkAnders Broman1-7/+7
svn path=/trunk/; revision=18234
2006-03-13SCSI is fairly unique among the ethereal protocols in that it is sometimes ↵Ronnie Sahlberg1-0/+12
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
2005-08-06If a dissector writer directly throws DissectorError, don't punish theGuy Harris1-3/+3
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-06Support throwing an exception with a null message pointer, and have theGuy Harris1-2/+8
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-04Exception handling fixes, and a fix to packet-frame.c,Gilbert Ramirez1-17/+67
from Richard van der Hoff. svn path=/trunk/; revision=15205
2005-08-02Explain the BoundsError and ReportedBoundsError errors a bit more, asGuy Harris1-0/+15
per Ulf Lamping's request. svn path=/trunk/; revision=15193
2005-03-11from Micheal Duigou: add some doxygen tags and some changes to README.developerUlf Lamping1-4/+25
svn path=/trunk/; revision=13725
2005-01-16Rename the FieldError exception to DissectorError.Guy Harris1-1/+1
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-16throw the new FieldError exception, if a dissector tries to add a field with ↵Ulf Lamping1-0/+1
invalid parameters add a message parameter to the show_exception function svn path=/trunk/; revision=13074
2003-10-23Add a new EXCEPT_CODE macro to get the exception code for the currentGuy Harris1-0/+2
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
2001-02-01Create a more modular type system for the FT_* types. Put themGilbert Ramirez1-0/+1
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
2000-09-27First step in moving core Ethereal routines to libepan.Gilbert Ramirez1-0/+203
svn path=/trunk/; revision=2458