[git] GCRYPT - branch, LIBGCRYPT-1-7-BRANCH, updated. libgcrypt-1.7.6-6-g9145675

by NIIBE Yutaka cvs at cvs.gnupg.org
Fri Jun 2 08:42:47 CEST 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU crypto library".

The branch, LIBGCRYPT-1-7-BRANCH has been updated
       via  91456759b887e153c4d4ce19538d478df260cab2 (commit)
      from  f9494b3f258e01b6af8bd3941ce436bcc00afc56 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 91456759b887e153c4d4ce19538d478df260cab2
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Fri Jun 2 10:34:42 2017 +0900

    secmem: Fix SEGV and stat calculation.
    
    * src/secmem (init_pool): Care about the header size.
    (_gcry_secmem_malloc_internal): Likewise.
    (_gcry_secmem_malloc_internal): Use mb->size for stats.
    
    --
    
    GnuPG-bug-id: 3027
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>

diff --git a/src/secmem.c b/src/secmem.c
index 46bbf82..b2a9667 100644
--- a/src/secmem.c
+++ b/src/secmem.c
@@ -454,7 +454,7 @@ init_pool (pooldesc_t *pool, size_t n)
 
   /* Initialize first memory block.  */
   mb = (memblock_t *) pool->mem;
-  mb->size = pool->size;
+  mb->size = pool->size - BLOCK_HEAD_SIZE;
   mb->flags = 0;
 }
 
@@ -610,7 +610,7 @@ _gcry_secmem_malloc_internal (size_t size, int xhint)
   mb = mb_get_new (pool, (memblock_t *) pool->mem, size);
   if (mb)
     {
-      stats_update (pool, size, 0);
+      stats_update (pool, mb->size, 0);
       return &mb->aligned.c;
     }
 
@@ -624,7 +624,7 @@ _gcry_secmem_malloc_internal (size_t size, int xhint)
           mb = mb_get_new (pool, (memblock_t *) pool->mem, size);
           if (mb)
             {
-              stats_update (pool, size, 0);
+              stats_update (pool, mb->size, 0);
               return &mb->aligned.c;
             }
         }
@@ -641,7 +641,7 @@ _gcry_secmem_malloc_internal (size_t size, int xhint)
         return NULL; /* Not enough memory available for a new pool.  */
       /* Initialize first memory block.  */
       mb = (memblock_t *) pool->mem;
-      mb->size = pool->size;
+      mb->size = pool->size - BLOCK_HEAD_SIZE;
       mb->flags = 0;
 
       pool->okay = 1;
@@ -660,7 +660,7 @@ _gcry_secmem_malloc_internal (size_t size, int xhint)
       mb = mb_get_new (pool, (memblock_t *) pool->mem, size);
       if (mb)
         {
-          stats_update (pool, size, 0);
+          stats_update (pool, mb->size, 0);
           return &mb->aligned.c;
         }
     }

-----------------------------------------------------------------------

Summary of changes:
 src/secmem.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
The GNU crypto library
http://git.gnupg.org




More information about the Gnupg-commits mailing list