Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/db/hash PR/50441: Manuel Bouyer: hash seq enumerati...



details:   https://anonhg.NetBSD.org/src/rev/f51375619534
branches:  trunk
changeset: 341686:f51375619534
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Nov 17 20:19:55 2015 +0000

description:
PR/50441: Manuel Bouyer: hash seq enumeration skips keys on big data.
XXX: pullup-7

diffstat:

 lib/libc/db/hash/hash.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (45 lines):

diff -r e82a633539ae -r f51375619534 lib/libc/db/hash/hash.c
--- a/lib/libc/db/hash/hash.c   Tue Nov 17 18:26:50 2015 +0000
+++ b/lib/libc/db/hash/hash.c   Tue Nov 17 20:19:55 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hash.c,v 1.35 2015/06/22 21:16:02 christos Exp $       */
+/*     $NetBSD: hash.c,v 1.36 2015/11/17 20:19:55 christos Exp $       */
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -37,7 +37,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: hash.c,v 1.35 2015/06/22 21:16:02 christos Exp $");
+__RCSID("$NetBSD: hash.c,v 1.36 2015/11/17 20:19:55 christos Exp $");
 
 #include "namespace.h"
 #include <sys/param.h>
@@ -770,7 +770,7 @@
                                hashp->cndx = 1;
                        }
                } else {
-                       bp = (uint16_t *)(void *)hashp->cpage->page;
+                       bp = (uint16_t *)(void *)bufp->page;
                        if (flag == R_NEXT || flag == 0) {
                                if (hashp->cndx > bp[0]) {
                                        hashp->cpage = NULL;
@@ -802,6 +802,7 @@
        if (bp[ndx + 1] < REAL_KEY) {
                if (__big_keydata(hashp, bufp, key, data, 1))
                        return (ERROR);
+               hashp->cndx = 1;
        } else {
                if (hashp->cpage == NULL)
                        return (ERROR);
@@ -809,8 +810,8 @@
                key->size = (ndx > 1 ? bp[ndx - 1] : hashp->BSIZE) - bp[ndx];
                data->data = (uint8_t *)hashp->cpage->page + bp[ndx + 1];
                data->size = bp[ndx] - bp[ndx + 1];
+               hashp->cndx += 2;
        }
-       hashp->cndx += 2;
        return (SUCCESS);
 }
 



Home | Main Index | Thread Index | Old Index