(Strictly speaking, this is an APR problem. But since it blew up in in 
fs-test, and the culprit happens to be GregS, I thought y'all might like 
to know about it. :-) )
Here's the deal:
apr_strings.h says:
/**
 * duplicate the first n characters of a string into memory allocated 
 * out of a pool; the new string will be '\0'-terminated
 * @param p The pool to allocate out of
 * @param s The string to duplicate
 * @param n The number of characters to duplicate
 * @return The new string
 * @deffunc char *apr_pstrndup(apr_pool_t *p, const char *s, apr_size_t n)
 */
cvs log apr_strings.c says:
----------------------------
revision 1.10
date: 2001/02/12 02:55:52;  author: gstein;  state: Exp;  lines: +7 -8
*) rename apr_memdup() to apr_pmemdup()
*) optimize the allocation size in apr_pstrndup()
Purify says:
[E] ABR: Array bounds read in strlen {1 occurrence}
        Reading 2 bytes from 0x0292e038 (1 byte at 0x0292e039 illegal)
        Address 0x0292e038 is argument #1 of strlen
        Address 0x0292e038 is at the beginning of a 1 byte block
        Address 0x0292e038 points to a malloc'd block in heap 0x01c10000
        Thread ID: 0x51c
        Error location
            strlen         [MSVCRTD.dll]
            apr_pstrndup   [apr_strings.c:91]
                    if (s == NULL) {
                        return NULL;
                    }
             =>     len = strlen(s);
                    if (len < n)
                        n = len;
                    res = apr_palloc(a, n + 1);
            allocate_txn_id [txn-table.c:133]
                  svn_fs__track_dbt (&value, trail->pool);
                
                  /* That's the value we want to return.  */
             =>   next_id_str = apr_pstrndup (trail->pool, value.data, value.size);
                
                  /* Try to parse the value.  */
                  {
            svn_fs__create_txn [txn-table.c:171]
Now, you might say that the doc says nothing about apr_pstrndup not 
needing a 0-terminated input. To which I reply that indeed, the doc says 
nothing about needing a 0-terminated input.
Greg, will you fix it, or shall I? :-)
-- 
Brane �ibej
    home:   <brane_at_xbc.nu>             http://www.xbc.nu/brane/
    work:   <branko.cibej_at_hermes.si>   http://www.hermes-softlab.com/
     ACM:   <brane_at_acm.org>            http://www.acm.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:30 2006