Wireshark-commits: [Wireshark-commits] master-3.2 499abc4: Kafka: fix the FETCH response alignment

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Sun, 5 Jul 2020 21:17:27 +0000
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=499abc41ffd60a13e74456b21973ffe27b22f290
Submitter: "Guy Harris <gharris@xxxxxxxxx>"
Changed: branch: master-3.2
Repository: wireshark

Commits:

499abc4 by Piotr Smolinski (piotr.smolinski@xxxxxxxxxxxx):

    Kafka: fix the FETCH response alignment issue
    
    There was a problem in FETCH response parsing when the server had more data than the requested
    maximal return size. In such case the server checks if the first chunk of data fits into buffer. If it does not,
    the first chunk is returned as a whole to the requestor. Otherwise it is assumed that the client is capable
    of discarding invalid content and the server pushes maximum available block. It makes sense, because
    the default block is 10MB and pushing it opaque leverages zero-copy IO from the file system to the network.
    
    In the existing implementation it was assumed that the last batch is aligned with the end of the buffer.
    Actually, if there is some data more, the last part is delivered truncated.
    
    This patch:
    * fixes the last part alignment handling
    * adds opaque field for truncated content
    * moves preferred replica field to the proper context
    
    Bug: 16623
    Change-Id: Iee6d513ce6711091e5561646a3fd563501eabdda
    Reviewed-on: https://code.wireshark.org/review/37446
    Petri-Dish: Alexis La Goutte <alexis.lagoutte@xxxxxxxxx>
    Tested-by: Petri Dish Buildbot
    Reviewed-by: Anders Broman <a.broman58@xxxxxxxxx>
    (cherry picked from commit 24712ec0733ffba581f44a333349dd21bc4427a7)
    Reviewed-on: https://code.wireshark.org/review/37722
    Reviewed-by: Guy Harris <gharris@xxxxxxxxx>
    

Actions performed:

    from  76afda9   kafka: lz4: free the composite tvb only once
     add  499abc4   Kafka: fix the FETCH response alignment issue


Summary of changes:
 epan/dissectors/packet-kafka.c | 48 ++++++++++++++++++++++++++++++------------
 1 file changed, 35 insertions(+), 13 deletions(-)