diff options
author | Guy Harris <guy@alum.mit.edu> | 2002-05-13 01:24:47 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2002-05-13 01:24:47 +0000 |
commit | b6e941027ff5b41a55bf23ce43d23e8ea5d49efc (patch) | |
tree | 3becaf90450ff578c7dc8dbcd051987b3ee15ba4 /epan/tvbuff.h | |
parent | ef67bf2d2f260b3e58cfb19ba550b517fb1196c0 (diff) | |
download | wireshark-b6e941027ff5b41a55bf23ce43d23e8ea5d49efc.tar.gz wireshark-b6e941027ff5b41a55bf23ce43d23e8ea5d49efc.tar.bz2 wireshark-b6e941027ff5b41a55bf23ce43d23e8ea5d49efc.zip |
Add a "tvb_ensure_bytes_exist()", which is like "tvb_bytes_exist()" only
it throws the appropriate exception if the bytes don't exist. Use it in
the GIOP and ASN.1 code to check whether the bytes to be copied to a
buffer exist before allocating the buffer.
Make "check_offset_length_no_exception()" check for an overflow, so that
it can be used in "tvb_ensure_bytes_exist()" and do all the checking
that the code "tvb_ensure_bytes_exist()" replaces did.
Make "get_CDR_wchar()" return a "gint", so that if the length octet it
fetched has a value between 128 and 255, the length can be returned
correctly.
Fix some comments not to specify the exception thrown by various
routines that can throw various exceptions.
svn path=/trunk/; revision=5453
Diffstat (limited to 'epan/tvbuff.h')
-rw-r--r-- | epan/tvbuff.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/epan/tvbuff.h b/epan/tvbuff.h index 159c4fa4ff..4b96f2a519 100644 --- a/epan/tvbuff.h +++ b/epan/tvbuff.h @@ -9,7 +9,7 @@ * the data of a backing tvbuff, or can be a composite of * other tvbuffs. * - * $Id: tvbuff.h,v 1.26 2002/05/05 00:57:59 guy Exp $ + * $Id: tvbuff.h,v 1.27 2002/05/13 01:24:47 guy Exp $ * * Copyright (c) 2000 by Gilbert Ramirez <gram@alumni.rice.edu> * @@ -192,13 +192,17 @@ extern guint tvb_length(tvbuff_t*); * indicate that offset is out of bounds. No exception is thrown. */ extern gint tvb_length_remaining(tvbuff_t*, gint offset); -/* Same as above, but throws BoundsError if the offset is out of bounds. */ +/* Same as above, but throws an exception if the offset is out of bounds. */ extern guint tvb_ensure_length_remaining(tvbuff_t*, gint offset); /* Checks (w/o throwing exception) that the bytes referred to by * 'offset'/'length' actually exist in the buffer */ extern gboolean tvb_bytes_exist(tvbuff_t*, gint offset, gint length); +/* Checks that the bytes referred to by 'offset'/'length' actually exist + * in the buffer, and throws an exception if they aren't. */ +extern void tvb_ensure_bytes_exist(tvbuff_t *tvb, gint offset, gint length); + /* Checks (w/o throwing exception) that offset exists in buffer */ extern gboolean tvb_offset_exists(tvbuff_t*, gint offset); @@ -223,7 +227,7 @@ extern void tvb_set_reported_length(tvbuff_t*, guint); extern gint tvb_raw_offset(tvbuff_t*); /************** START OF ACCESSORS ****************/ -/* All accessors will throw BoundsError or ReportedBoundsError if appropriate */ +/* All accessors will throw an exception if appropriate */ extern guint8 tvb_get_guint8(tvbuff_t*, gint offset); |