summaryrefslogtreecommitdiffabout
path: root/tests
authorSergey Poznyakoff <gray@gnu.org>2018-05-26 20:17:10 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2018-05-27 15:16:03 (GMT)
commit4011b4ce9a4c4fa505843381d43a1157cf0c782e (patch) (side-by-side diff)
tree3b12f036a9dabd412a0ada3d6e0c07f44a2dfc91 /tests
parentd100aa7a304913fa1692abaa2818418409f3668a (diff)
downloadgdbm-4011b4ce9a4c4fa505843381d43a1157cf0c782e.tar.gz
gdbm-4011b4ce9a4c4fa505843381d43a1157cf0c782e.tar.bz2
Additional validation of avail_table.
Verify that avail_table is sorted by size and that each element's size falls within allowed range. * src/bucket.c (gdbm_get_bucket): Fix bucket validation. Validate bucket_avail. (_gdbm_split_bucket): Check return from _gdbm_free. * src/falloc.c (adjust_bucket_avail,_gdbm_free): Return error code. All uses updated. (pop_avail_block): Fix eventual memory leak. Use gdbm_avail_block_validate. * src/gdbmdefs.h (gdbm_avail_table_valid_p): Change signature. * src/gdbmopen.c (gdbm_avail_table_valid_p): Traverse the array verifying address and size of each element. (gdbm_avail_block_validate) (gdbm_bucket_avail_table_validate): New functions. (validate_header): Remove call to gdbm_avail_block_valid_p. Avail_block is validated later, after it's been loaded. Bail out if header->next_block does not equal the file size. (gdbm_fd_open): Validate avail_block. * src/gdbmstore.c (_gdbm_store): Check return from _gdbm_free. Avoid endless loop in case of inconsistent h_table. * src/gdbmtool.c (_gdbm_print_avail_list): Use gdbm_avail_block_validate. * src/proto.h: Update. * tests/gtload.c: Improve error diagnostics.
Diffstat (limited to 'tests') (more/less context) (ignore whitespace changes)
-rw-r--r--tests/gtload.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/gtload.c b/tests/gtload.c
index cc66b94..273ebbe 100644
--- a/tests/gtload.c
+++ b/tests/gtload.c
@@ -333,8 +333,8 @@ main (int argc, char **argv)
data.dsize = strlen (data.dptr) + data_z;
if (gdbm_store (dbf, key, data, replace) != 0)
{
- fprintf (stderr, "%s: %d: item not inserted\n",
- progname, line);
+ fprintf (stderr, "%s: %d: item not inserted: %s\n",
+ progname, line, gdbm_db_strerror (dbf));
if (gdbm_needs_recovery (dbf) && recover)
{
int rc = gdbm_recover (dbf, &rcvr, rcvr_flags);

Return to:

Send suggestions and report system problems to the System administrator.