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-1.12 047c4c0: packet-vnc.c: Improve re-assembly.

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Thu, 3 Jul 2014 17:15:48 +0000 (UTC)
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=047c4c07551ceb5c8b9d2a97dbe7aa657f743d5d
Submitter: Bill Meier (wmeier@xxxxxxxxxxx)
Changed: branch: master-1.12
Repository: wireshark

Commits:

047c4c0 by Bill Meier (wmeier@xxxxxxxxxxx):

    packet-vnc.c: Improve re-assembly.
    
    Essentially:
    
      When more data is needed to continue dissecting a PDU, use
      DESEGMENT_ONE_MORE_SEGMENT instead of repeatedly requesting
      additional bytes (for one or a few more fields).
    
      - Improves the efficiency of the dissection;
    
      - Prevents 'one-pass' tshark dissection from redissecting
        the PDU repeatedly many, many times with each time dissecting
        the PDU with one or a few more additional fields.
        This generated *lots* of (repeated) output since a reassembled
        VNC PDU can contain many fields (each of short length).
    
      - (A comment in packet-tcp.c states, in effect, that repeatedly
         requesting a specific amount of more bytes to dissect a PDU
         will "break reassembly" although I note that the reassembly did
         seem to work (in-efficiently)).
    
    Note: Although this patch improves the handling of reassembly, the
          dissector has significant issues. For example. see Bug #5366.
    
    I expect this fixes the Bug #10134 issue: "Cannot allocate memory";
    
    Before the fix, 'tshark -nVxr' for the input file generated trees with
    multiple hundreds of thousands of entries and generated reassembled
    PDUs consisting of many, many small fragments.
    
    Change-Id: I970037c346fbaa4bffa5726fd5bee5f69396eabf
    Reviewed-on: https://code.wireshark.org/review/2471
    Reviewed-by: Bill Meier <wmeier@xxxxxxxxxxx>
    (cherry picked from commit 728e5a1ab3e2614ec83a6af43a52742cf0f5df01)
    Reviewed-on: https://code.wireshark.org/review/2821
    

Actions performed:

    from  71cb629   catapult,irda: Fix ASAN crashes due to buffer underrun
    adds  047c4c0   packet-vnc.c: Improve re-assembly.


Summary of changes:
 epan/dissectors/packet-vnc.c |   23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)