Re: [PATCH] strbuf_getwholeline: NUL-terminate getdelim buffer on error

2016-03-05 Thread Jeff King
On Sat, Mar 05, 2016 at 11:33:08AM -0800, Junio C Hamano wrote: > Jeff King writes: > > > Not a big rush for 2.8.0-rc, as the bug is in v2.5.0, and I doubt > > there's an easy trigger besides fast-import. But it might be harmless > > enough to squeeze in. > > Was it found by a real-world debugg

Re: [PATCH] strbuf_getwholeline: NUL-terminate getdelim buffer on error

2016-03-05 Thread Junio C Hamano
Jeff King writes: > Not a big rush for 2.8.0-rc, as the bug is in v2.5.0, and I doubt > there's an easy trigger besides fast-import. But it might be harmless > enough to squeeze in. Was it found by a real-world debugging session, or by a code inspection? I'd be really impressed if it were the l

[PATCH] strbuf_getwholeline: NUL-terminate getdelim buffer on error

2016-03-05 Thread Jeff King
Commit 0cc30e0 (strbuf_getwholeline: use getdelim if it is available, 2015-04-16) tries to clean up after getdelim() returns EOF, but gets one case wrong, which can lead in some obscure cases to us reading uninitialized memory. After getdelim() returns -1, we re-initialize the strbuf only if sb->b