Skip to content
  • Jeff King's avatar
    read_istream_pack_non_delta(): document input handling · 0afbe3e8
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    Twice now we have scratched our heads about why the loose streaming code
    needs the protection added by 692f0bc7
    
     (avoid infinite loop in
    read_istream_loose, 2013-03-25), but the similar code in its pack
    counterpart does not.
    
    The short answer is that use_pack() will die before it lets us run out
    of bytes. Note that this could mean reading garbage (including the
    trailing hash) from the packfile in some cases of corruption, but that's
    OK. zlib will notice and complain (and if not, certainly the end result
    will not match the object hash we expect).
    
    Let's leave a comment this time to document our findings.
    
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    0afbe3e8