redrabbit / git.limo

A Git source code management tool powered by Elixir with easy installation & high extensibility.
https://git.limo
MIT License
497 stars 42 forks source link

Error when parsing large Git packfiles. #11

Closed redrabbit closed 5 years ago

redrabbit commented 6 years ago

Somehow GitRekt.Packfile.parse/1 fails to parse large inputs.

Possible cause(s):

redrabbit commented 6 years ago
  • Invalid reading of (large?) deflated objects (see GitRekt.Git.object_zlib_inflate/1).

Seems like commit a15d337 fixes this issue. Increasing zlib's buffer size to 256K did the trick.

  • Invalid parsing of OBJ_REF_DELTA objects.

After investigating this for a while (see 3d1357f), it looks like some (a small percentage) of delta-reference objects are not parsed correctly. A possible issue could be that unpack_obj_delta_size/3, delta_copy_length_size/1 or delta_copy_offset_size/1 is not implemented correctly.

redrabbit commented 5 years ago
  • Invalid parsing of OBJ_REF_DELTA objects.

Looks like parsing fails to read delta_copy_length_size when 0 is passed.

Git pack-format specs here: https://git-scm.com/docs/pack-format#_deltified_representation https://www.ietf.org/rfc/rfc1951.txt