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