login
Header Space

 
 

Re: Use of strbuf.buf when strbuf.len == 0

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Junio C Hamano <gitster@...>
Cc: <git@...>
Date: Thursday, September 27, 2007 - 6:13 am

On Thu, Sep 27, 2007 at 06:21:24AM +0000, Junio C Hamano wrote:

  I can see a way, that would need special proof-reading of the strbuf
module, but should not harm its users, that would be to change
STRBUF_INIT to work this way:

  { .buf =3D "", .len =3D 0, .alloc =3D 0 }

  It needs to make strbuf_grow and strbuf_release check for ->alloc
before doing anything stupid.

  Though we may have some bits of code that rely on .buf being NULL if
nothing happened. I tried to track them down, but some may remain.

  If you agree with this change, that would solve most of the issues
with almost no cost, then I'll propose a new patch with this change.

--=20
=C2=B7O=C2=B7  Pierre Habouzit
=C2=B7=C2=B7O                                                madcoder@debia=
n.org
OOO                                                http://www.madism.org
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Use of strbuf.buf when strbuf.len == 0, Junio C Hamano, (Thu Sep 27, 2:21 am)
Re: Use of strbuf.buf when strbuf.len == 0, Pierre Habouzit, (Thu Sep 27, 7:22 am)
[PROPER PATCH 1/1] Make read_patch_file work on a strbuf., Pierre Habouzit, (Thu Sep 27, 7:33 am)
Re: Use of strbuf.buf when strbuf.len == 0, Pierre Habouzit, (Thu Sep 27, 7:37 am)
[PATCH 1/1] Make read_patch_file work on a strbuf., Pierre Habouzit, (Thu Sep 27, 7:33 am)
Re: Use of strbuf.buf when strbuf.len == 0, Pierre Habouzit, (Thu Sep 27, 6:13 am)
Re: Use of strbuf.buf when strbuf.len == 0, Linus Torvalds, (Fri Sep 28, 8:51 pm)
Re: Use of strbuf.buf when strbuf.len == 0, Pierre Habouzit, (Sat Sep 29, 3:48 am)
[PATCH 1/2] double free in builtin-update-index.c, Pierre Habouzit, (Thu Sep 27, 6:51 am)
speck-geostationary