You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Greg Stein <gs...@lyra.org> on 2001/12/19 00:16:20 UTC

Re: svn commit: rev 653 - trunk/subversion/libsvn_fs trunk/subversion/tests/libsvn_fs

On Mon, Dec 17, 2001 at 11:31:41AM -0600, cmpilato@tigris.org wrote:
> Author: cmpilato
> Date: 2001-12-17 17:31 GMT
> New Revision: 653
> 
> Modified:
>    trunk/subversion/libsvn_fs/dag.c
>    trunk/subversion/tests/libsvn_fs/fs-test.c
> Log:
> * subversion/libsvn_fs/dag.c
> 
>   (svn_fs__dag_get_revision): Bug fix -- C-Mike forgot that skel_t's
>   don't have null-terminated data.  You gotsta pay attention to the
>   "len" field.
>...
> -  *rev = atoi ((SVN_FS__NR_HDR_REV (SVN_FS__NR_HEADER (node_rev)))->data);

As a curiosity, why was this failing? Shouldn't atoi() stop parsing at the
first non-integer character? What was it doing such that it returned a funny
value?

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

Re: svn commit: rev 653 - trunk/subversion/libsvn_fs trunk/subversion/tests/libsvn_fs

Posted by Philip Martin <ph...@codematters.co.uk>.
Greg Stein <gs...@lyra.org> writes:

> > -  *rev = atoi ((SVN_FS__NR_HDR_REV (SVN_FS__NR_HEADER (node_rev)))->data);
> 
> As a curiosity, why was this failing? Shouldn't atoi() stop parsing at the
> first non-integer character? What was it doing such that it returned a funny
> value?

Nothing ensured it *was* non-integer. I posted this example yesterday:

> Breakpoint 3, svn_fs__dag_get_revision (rev=0xbffff5c0, node=0x807ba30, 
>     trail=0x8079618) at subversion/libsvn_fs/dag.c:291
> 291       SVN_ERR (get_node_revision (&node_rev, node, trail));
> (gdb) n
> 292       *rev = atoi ((SVN_FS__NR_HDR_REV (SVN_FS__NR_HEADER (node_rev)))->data);
> 
> (gdb) p node_rev[0].children[0].children[0].next[0]
> $5 = {is_atom = 1, data = 0x807bb88 "216:03:2\001", len = 1, children = 0x0, 
>   next = 0x0}
> 
> and the revison number comes out at 216. That might be memory
> corruption, but could it be that the correct revison is 2, and that
> there is a missing null terminator? The len field indcates 1 but
> atoi() won't use that.

-- 
Philip

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org