Re: Odd git overrflow bug?
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Jul 10, 2016, 21:21 UTC
- Message-ID
- <CA+55aFwvZqqSkphgL+UBqfXnSGAFEzmqyH83OMGnpco3ZVZUnA@mail.gmail.com>
- In-Reply-To
- <CA+55aFymKO5Bi2qZ-zaiZKQAk7RxusEMJ9Y0Gw6ywdznK+TaRQ@mail.gmail.com>
On Sun, Jul 10, 2016 at 2:05 PM, Linus Torvalds <torvalds@linux-foundation.org> wrote:
> > I'm getting "extra" being -1 in strbuf_grow(). Let me dog deeper.
"dog deeper"? My typing skills are deteriorating.
Anyway, I dug deeper, and the reason is that "tabwidth" is -1, and then
pretty.c:1669: strbuf_add_tabexpand():
strbuf_addchars(sb, ' ', tabwidth - (width % tabwidth));
ends up having the number be -1.
I'm not sure why it doesn't happen in current git master, because that function is the same, and the logic around expand_tabs_in_log looks similar too.
That all came from
fe37a9c586a6 (:pretty: allow tweaking tabwidth in --expand-tabs")
and I suspect the code just needs to protect against negative or zero, rather than just zero.
Junio?
Linus