Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-commits: [Wireshark-commits] master 0a130c5: Handle subset tvbuffs where the length goes

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Fri, 20 Apr 2018 03:18:58 +0000
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=0a130c5756eda79cbb55f1d38824fbaf9d1abc68
Submitter: Guy Harris (guy@xxxxxxxxxxxx)
Changed: branch: master
Repository: wireshark

Commits:

0a130c5 by Guy Harris (guy@xxxxxxxxxxxx):

    Handle subset tvbuffs where the length goes past the end of the parent.
    
    Add a "contained length" to tvbuffs.  For non-subset tvbuffs, that's the
    same as the reported length.  For a subset tvbuff, that's the amount of
    the reported data that was actually present in the "contained data" of
    the parent tvbuff.
    
    This is unaffected by the *captured* length of any tvbuff; that differs
    from the contained length only if the capture was cut short by a
    snapshot length.
    
    If a reference is within the reported data, but not within the contained
    data, a ContainedBoundsError exception is thrown.  This exception
    represents a protocol error, rather than a reference past the captured
    data in the packet; we treat it as such.
    
    Change-Id: Ide87f81238eaeb89b3093f54a87bf7f715485af5
    Reviewed-on: https://code.wireshark.org/review/27039
    Reviewed-by: Guy Harris <guy@xxxxxxxxxxxx>
    

Actions performed:

    from  9011a25   More indentation cleanups.
    adds  0a130c5   Handle subset tvbuffs where the length goes past the end of the parent.


Summary of changes:
 epan/dissectors/packet-scsi-mmc.c       |   4 +-
 epan/dissectors/packet-scsi.h           |  44 ++++----
 epan/dissectors/packet-windows-common.c |  24 ++---
 epan/exceptions.h                       |  65 ++++++++----
 epan/packet.c                           |   4 +-
 epan/show_exception.c                   |   8 ++
 epan/tvbuff-int.h                       |  20 +++-
 epan/tvbuff.c                           | 179 ++++++++++++++++++++++----------
 epan/tvbuff_composite.c                 |   2 +
 epan/tvbuff_real.c                      |   9 +-
 epan/tvbuff_subset.c                    |  33 ++++--
 frame_tvbuff.c                          |  27 ++---
 12 files changed, 273 insertions(+), 146 deletions(-)