map files over 2GB could not be loaded

- fixed a size comparison using "signed int" that failed if the file
  size was more than 2GB, since that was treated as a negative number.
- incidentally renamed deserialize32() to just deserialize(). we no
  longer have separate 32 and 64 bit rbtdb implementations.
This commit is contained in:
Evan Hunt 2021-08-24 12:22:32 -07:00
parent 113add8a9d
commit 3b544d28bf
2 changed files with 7 additions and 6 deletions

View file

@ -775,17 +775,18 @@ treefix(dns_rbt_t *rbt, void *base, size_t filesize, dns_rbtnode_t *n,
uint64_t *crc) {
isc_result_t result = ISC_R_SUCCESS;
dns_fixedname_t fixed;
dns_name_t nodename, *fullname;
unsigned char *node_data;
dns_name_t nodename, *fullname = NULL;
unsigned char *node_data = NULL;
dns_rbtnode_t header;
size_t datasize, nodemax = filesize - sizeof(dns_rbtnode_t);
size_t nodemax = filesize - sizeof(dns_rbtnode_t);
size_t datasize;
if (n == NULL) {
return (ISC_R_SUCCESS);
}
CONFIRM((void *)n >= base);
CONFIRM((char *)n - (char *)base <= (int)nodemax);
CONFIRM((size_t)((char *)n - (char *)base) <= nodemax);
CONFIRM(DNS_RBTNODE_VALID(n));
dns_name_init(&nodename, NULL);

View file

@ -7579,7 +7579,7 @@ rbt_datafixer(dns_rbtnode_t *rbtnode, void *base, size_t filesize, void *arg,
* Load the RBT database from the image in 'f'
*/
static isc_result_t
deserialize32(void *arg, FILE *f, off_t offset) {
deserialize(void *arg, FILE *f, off_t offset) {
isc_result_t result;
rbtdb_load_t *loadctx = arg;
dns_rbtdb_t *rbtdb = loadctx->rbtdb;
@ -7724,7 +7724,7 @@ beginload(dns_db_t *db, dns_rdatacallbacks_t *callbacks) {
callbacks->add = loading_addrdataset;
callbacks->add_private = loadctx;
callbacks->deserialize = deserialize32;
callbacks->deserialize = deserialize;
callbacks->deserialize_private = loadctx;
return (ISC_R_SUCCESS);