author | Sebastian Schuberth <sschuberth@gmail.com> | |
Fri, 28 Oct 2011 15:28:28 +0000 (17:28 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 28 Oct 2011 15:41:56 +0000 (08:41 -0700) | ||
commit | 2564aa48ce007ad265c0d31a7cb7513239447d2b | |
tree | 087f2a1832cebc2aecba80398bb59dce90efa150 | tree | snapshot |
parent | 900647104e02e545064789f3c6b90a5807fba07b | commit | diff |
blame.c: Properly initialize strbuf after calling, textconv_object()
For a plain string where only the length is known, strbuf.alloc needs to
be initialized to the length. Otherwise strbuf.alloc is 0 and a later
call to strbuf_setlen() will fail.
This bug surfaced when calling git blame under Windows on a *.doc file.
The *.doc file is converted to plain text by antiword via the textconv
mechanism. However, the plain text returned by antiword contains DOS line
endings instead of Unix line endings which triggered the strbuf_setlen()
which previous to this patch failed.
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
For a plain string where only the length is known, strbuf.alloc needs to
be initialized to the length. Otherwise strbuf.alloc is 0 and a later
call to strbuf_setlen() will fail.
This bug surfaced when calling git blame under Windows on a *.doc file.
The *.doc file is converted to plain text by antiword via the textconv
mechanism. However, the plain text returned by antiword contains DOS line
endings instead of Unix line endings which triggered the strbuf_setlen()
which previous to this patch failed.
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/blame.c | diff | blob | history |