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

RE: Unsafe WC DB calls: sqlite_column_text(..., pool=NULL)

From: Bert Huijben <bert_at_qqmail.nl>
Date: Tue, 29 Jan 2013 18:45:06 +0100

> -----Original Message-----
> From: Bert Huijben [mailto:bert_at_qqmail.nl]
> Sent: dinsdag 29 januari 2013 18:35
> To: 'Julian Foad'; 'Subversion Development'
> Subject: RE: Unsafe WC DB calls: sqlite_column_text(..., pool=NULL)
>
>
>
> > -----Original Message-----
> > From: Julian Foad [mailto:julianfoad_at_btopenworld.com]
> > Sent: dinsdag 29 januari 2013 17:15
> > To: Subversion Development
> > Subject: Unsafe WC DB calls: sqlite_column_text(..., pool=NULL)
> >
> > I noticed code like this in wc_db.c:
> >
> >   const char *relpath = svn_sqlite__column_text(stmt, 0, NULL);
> >   svn_kind_t kind = svn_sqlite__column_token(stmt, 1, kind_map);
> >
> >
> > According to the docs [1], the second _column_*() call can overwrite the
> > value returned by the first one, since we passed NULL as the
'result_pool'
> > argument.
>
> Then we should fix our docs.
>
> It is safe until you go to the next row.

Looking at the sqlite docs: unless there are type conversions, but in this
case there aren't any.
Nor should there be any of these conversions in our code as we don't use
utf-16

You might be able to trigger them when accessing wc.db with different tools
that do insert some utf-16, but I don't think we should update all our code
to handle that, for some theoretical corner cases.

        Bert
Received on 2013-01-29 18:45:49 CET

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.