From 551d394440d820e877e73c048f8ea4ba1d27bf17 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Sat, 23 Jun 2018 12:48:08 +0300 Subject: Fix the previous patch --- src/gdbmopen.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gdbmopen.c b/src/gdbmopen.c index 9747517..dc5a89e 100644 --- a/src/gdbmopen.c +++ b/src/gdbmopen.c @@ -69,7 +69,7 @@ avail_comp (void const *a, void const *b) As a side effect, ensures the array is sorted by element size in increasing order and restores the ordering if necessary. - The proper ordering could have been clobbered in versions of GDBM<=1.14, + The proper ordering could have been clobbered in versions of GDBM<=1.15, by a call to _gdbm_put_av_elem with the can_merge parameter set to TRUE. This happened in two cases: either because the GDBM_COALESCEBLKS was set, and (quite unfortunately) when _gdbm_put_av_elem was called @@ -84,16 +84,17 @@ gdbm_avail_table_valid_p (GDBM_FILE dbf, avail_elem *av, int count) off_t prev = 0; int i; int needs_sorting = 0; + avail_elem *p = av; prev = 0; - for (i = 0; i < count; i++, av++) + for (i = 0; i < count; i++, p++) { - if (!(av->av_adr >= dbf->header->bucket_size - && av->av_adr + av->av_size <= dbf->header->next_block)) + if (!(p->av_adr >= dbf->header->bucket_size + && p->av_adr + p->av_size <= dbf->header->next_block)) return 0; - if (av->av_size < prev) + if (p->av_size < prev) needs_sorting = 1; - prev = av->av_size; + prev = p->av_size; } if (needs_sorting && dbf->read_write) -- cgit v1.2.1