Re: [PATCH 2/2] Make hash-object more robust against malformed objects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nguyán ThÃi Ngác Duy wrote:
> Commits, trees and tags have structure. Don't let users feed git
> with malformed ones. Sooner or later git will die() when
> encountering them.
> 
> Note that this patch does not check semantics. A tree that points
> to non-existent objects is perfectly OK (and should be so, users
> may choose to add commit first, then its associated tree for example)
> 
> Signed-off-by: Nguyán ThÃi Ngác Duy <pclouds@xxxxxxxxx>

This patch makes t9350 fail under valgrind:

expecting success: 

        TAG=$(git hash-object -t tag -w tag-content) &&
        git update-ref refs/tags/sonnenschein $TAG &&
        git fast-export -C -C --signed-tags=strip --all > output &&
        test $(grep -c "^tag " output) = 4 &&
        ! grep "Unspecified Tagger" output &&
        git fast-export -C -C --signed-tags=strip --all \
                --fake-missing-tagger > output &&
        test $(grep -c "^tag " output) = 4 &&
        grep "Unspecified Tagger" output


==2862== Invalid read of size 1
==2862==    at 0x4F0C34: prefixcmp (strbuf.c:9)
==2862==    by 0x4F4FB3: parse_tag_buffer (tag.c:109)
==2862==    by 0x4EC686: check_tag (sha1_file.c:2499)
==2862==    by 0x4EC77F: index_mem (sha1_file.c:2529)
==2862==    by 0x4EC934: index_fd (sha1_file.c:2563)
==2862==    by 0x4379C9: hash_fd (hash-object.c:17)
==2862==    by 0x437A86: hash_object (hash-object.c:33)
==2862==    by 0x437E82: cmd_hash_object (hash-object.c:126)
==2862==    by 0x404771: run_builtin (git.c:290)
==2862==    by 0x4048FC: handle_internal_command (git.c:448)
==2862==    by 0x4049E7: run_argv (git.c:492)
==2862==    by 0x404B43: main (git.c:565)
==2862==  Address 0x55abb77 is 0 bytes after a block of size 71 alloc'd
==2862==    at 0x4C20E1C: malloc (vg_replace_malloc.c:195)
==2862==    by 0x504A7C: xmalloc (wrapper.c:35)
==2862==    by 0x4EC8E8: index_fd (sha1_file.c:2561)
==2862==    by 0x4379C9: hash_fd (hash-object.c:17)
==2862==    by 0x437A86: hash_object (hash-object.c:33)
==2862==    by 0x437E82: cmd_hash_object (hash-object.c:126)
==2862==    by 0x404771: run_builtin (git.c:290)
==2862==    by 0x4048FC: handle_internal_command (git.c:448)
==2862==    by 0x4049E7: run_argv (git.c:492)
==2862==    by 0x404B43: main (git.c:565)
==2862== 
==2862== Invalid read of size 1
==2862==    at 0x4F0C50: prefixcmp (strbuf.c:10)
==2862==    by 0x4F4FB3: parse_tag_buffer (tag.c:109)
==2862==    by 0x4EC686: check_tag (sha1_file.c:2499)
==2862==    by 0x4EC77F: index_mem (sha1_file.c:2529)
==2862==    by 0x4EC934: index_fd (sha1_file.c:2563)
==2862==    by 0x4379C9: hash_fd (hash-object.c:17)
==2862==    by 0x437A86: hash_object (hash-object.c:33)
==2862==    by 0x437E82: cmd_hash_object (hash-object.c:126)
==2862==    by 0x404771: run_builtin (git.c:290)
==2862==    by 0x4048FC: handle_internal_command (git.c:448)
==2862==    by 0x4049E7: run_argv (git.c:492)
==2862==    by 0x404B43: main (git.c:565)
==2862==  Address 0x55abb77 is 0 bytes after a block of size 71 alloc'd
==2862==    at 0x4C20E1C: malloc (vg_replace_malloc.c:195)
==2862==    by 0x504A7C: xmalloc (wrapper.c:35)
==2862==    by 0x4EC8E8: index_fd (sha1_file.c:2561)
==2862==    by 0x4379C9: hash_fd (hash-object.c:17)
==2862==    by 0x437A86: hash_object (hash-object.c:33)
==2862==    by 0x437E82: cmd_hash_object (hash-object.c:126)
==2862==    by 0x404771: run_builtin (git.c:290)
==2862==    by 0x4048FC: handle_internal_command (git.c:448)
==2862==    by 0x4049E7: run_argv (git.c:492)
==2862==    by 0x404B43: main (git.c:565)
==2862== 
not ok - 15 cope with tagger-less tags
#       
#       
#               TAG=$(git hash-object -t tag -w tag-content) &&
#               git update-ref refs/tags/sonnenschein $TAG &&
#               git fast-export -C -C --signed-tags=strip --all > output &&
#               test $(grep -c "^tag " output) = 4 &&
#               ! grep "Unspecified Tagger" output &&
#               git fast-export -C -C --signed-tags=strip --all \
#                       --fake-missing-tagger > output &&
#               test $(grep -c "^tag " output) = 4 &&
#               grep "Unspecified Tagger" output
#       
#       

-- 
Thomas Rast
trast@{inf,student}.ethz.ch
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]