subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1697828 - /subversion/trunk/subversion/libsvn_subr/cache-membuffer.c
Date Wed, 26 Aug 2015 07:14:59 GMT
Author: brane
Date: Wed Aug 26 07:14:59 2015
New Revision: 1697828

URL: http://svn.apache.org/r1697828
Log:
Fix a 64-bit to 32-bit conversion warning on 64-bit platforms.

* subversion/libsvn_subr/cache-membuffer.c
  (prefix_pool_get_internal): Safely cast a pointer to an index, with range check.

Modified:
    subversion/trunk/subversion/libsvn_subr/cache-membuffer.c

Modified: subversion/trunk/subversion/libsvn_subr/cache-membuffer.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/cache-membuffer.c?rev=1697828&r1=1697827&r2=1697828&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/cache-membuffer.c (original)
+++ subversion/trunk/subversion/libsvn_subr/cache-membuffer.c Wed Aug 26 07:14:59 2015
@@ -339,7 +339,9 @@ prefix_pool_get_internal(apr_uint32_t *p
   value = apr_hash_get(prefix_pool->map, prefix, prefix_len);
   if (value != NULL)
     {
-      *prefix_idx = value - prefix_pool->values;
+      const apr_size_t index = value - prefix_pool->values;
+      SVN_ERR_ASSERT(index < prefix_pool->values_used);
+      *prefix_idx = (apr_uint32_t) index;
       return SVN_NO_ERROR;
     }
 



Mime
View raw message