[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: rev 5621 - trunk/subversion/libsvn_diff

From: Blair Zajac <blair_at_orcaware.com>
Date: 2003-04-15 20:26:41 CEST

From: Greg Stein <gstein@lyra.org>
> On Mon, Apr 14, 2003 at 04:56:35PM -0500, blair@tigris.org wrote:
> >...
> > +++ trunk/subversion/libsvn_diff/diff_file.c Mon Apr 14 16:56:29 2003
> >...
> > - file_baton->curp[idx] = file_baton->buffer[idx];
> > - file_baton->endp[idx] = file_baton->buffer[idx] + finfo.size;
> > + /* Testing for a non-zero sized file works around an assert style
> > + * core dump generated by bounds checking GCC compiled code on a
> > + * NULL pointer used in pointer arithmetic. */
> > + if (finfo.size)
> > + {
> > + file_baton->curp[idx] = file_baton->buffer[idx];
> > + file_baton->endp[idx] = file_baton->buffer[idx] + finfo.size;
> > + }
> > + else
> > + {
> > + file_baton->curp[idx] = NULL;
> > + file_baton->endp[idx] = NULL;
> > + }
> >
> That seems like the wrong test. Don't you want to check file_baton->buffer
> rather than finfo.size? Your comment is about a NULL pointer, so check the
> pointer value, not an unrelated size.

Not that this matters now with the new code, but the code flow above this
point tests finfo.size == 0 to either set file_baton->buffer to NULL or
to point it to the file's contents. To be consistent with this, I did
the commit as is.

Blair

-- 
Blair Zajac <blair@orcaware.com>
Plots of your system's performance - http://www.orcaware.com/orca/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Apr 15 20:27:30 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.