[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: Greg Stein <gstein_at_lyra.org>
Date: 2003-04-15 02:20:25 CEST

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.

>...
> - baton.curp[idx] = baton.buffer[idx];
> - baton.endp[idx] = 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)
> + {
> + baton.curp[idx] = baton.buffer[idx];
> + baton.endp[idx] = baton.buffer[idx] + finfo.size;
> + }
> + else
> + {
> + baton.curp[idx] = NULL;
> + baton.endp[idx] = NULL;
> + }

And here.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Apr 15 02:20:52 2003

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