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