diff --git a/CHANGES b/CHANGES index b8ea0b1602..f96de23205 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +5711. [bug] "map" files exceeding 2GB in size could fail to + load due to a size comparison that incorrectly + treated the file size as a signed integer. [GL #2878] + 5710. [placeholder] 5709. [func] Zone types are now reported in the statistics channel @@ -34,7 +38,7 @@ 5701. [bug] named-checkconf failed to detect syntactically invalid key and tls names. [GL #2461] -5700. [bug] Journals where not being removed when a catalog zone +5700. [bug] Journals were not being removed when a catalog zone was removed. [GL #2842] 5699. [func] Grow and shrink dnssec-sign statistics on key rollover diff --git a/bin/tests/system/masterformat/clean.sh b/bin/tests/system/masterformat/clean.sh index 80289e9267..82502fc430 100755 --- a/bin/tests/system/masterformat/clean.sh +++ b/bin/tests/system/masterformat/clean.sh @@ -26,7 +26,7 @@ rm -f ./ns2/formerly-text.db rm -f ./ns2/db-* rm -f ./ns2/large.bk rm -f ./ns3/example.db.map ./ns3/dynamic.db.map -rm -f ./baseline.txt ./text.1 ./text.2 ./raw.1 ./raw.2 ./map.1 ./map.2 ./map.5 ./text.5 ./badmap +rm -f ./baseline.txt ./text.* ./raw.* ./map.* ./badmap rm -f ./ns1/Ksigned.* ./ns1/dsset-signed. ./ns1/signed.db.signed rm -f ./rndc.out rm -f ./ns*/named.lock diff --git a/bin/tests/system/masterformat/tests.sh b/bin/tests/system/masterformat/tests.sh index d17f4983b5..6a0453e185 100755 --- a/bin/tests/system/masterformat/tests.sh +++ b/bin/tests/system/masterformat/tests.sh @@ -330,5 +330,22 @@ n=$((n+1)) [ $ret -eq 0 ] || echo_i "failed" status=$((status+ret)) +# The following test is disabled by default because it is very slow. +if [ -n "${TEST_LARGE_MAP}" ]; then + echo_i "checking map file size > 2GB can be loaded ($n)" + ret=0 + $PERL ../../startperf/mkzonefile.pl test 9000000 > text.$n + # convert to map + $CHECKZONE -D -f text -F map -o map.$n test text.$n > /dev/null || ret=1 + # check map file size is over 2GB to ensure the test is valid + size=$(ls -l map.$n | awk '{print $5}') + [ "$size" -gt 2147483648 ] || ret=1 + # convert back to text + $CHECKZONE -f map test map.$n > /dev/null || ret=1 + n=$((n+1)) + [ $ret -eq 0 ] || echo_i "failed" + status=$((status+ret)) +fi + echo_i "exit status: $status" [ $status -eq 0 ] || exit 1 diff --git a/bin/tests/system/run.sh.in b/bin/tests/system/run.sh.in index b4d14cd8cf..bd4c38e843 100644 --- a/bin/tests/system/run.sh.in +++ b/bin/tests/system/run.sh.in @@ -72,7 +72,7 @@ if ! $do_run; then if [ "$baseport" -eq 0 ]; then log_flags="$log_flags -p 5300" fi - env - CYGWIN="$CYGWIN" SYSTEMTEST_FORCE_COLOR="$SYSTEMTEST_FORCE_COLOR" SYSTEMTEST_NO_CLEAN="$SYSTEMTEST_NO_CLEAN" SLOT="$SLOT" SOFTHSM2_CONF="$SOFTHSM2_CONF" PATH="$PATH" ${LD_LIBRARY_PATH:+"LD_LIBRARY_PATH=${LD_LIBRARY_PATH}"} TESTS="$*" TEST_SUITE_LOG=run.log LOG_DRIVER_FLAGS="--verbose yes --color-tests yes" LOG_FLAGS="$log_flags" make -e check + env - CYGWIN="$CYGWIN" SYSTEMTEST_FORCE_COLOR="$SYSTEMTEST_FORCE_COLOR" SYSTEMTEST_NO_CLEAN="$SYSTEMTEST_NO_CLEAN" SLOT="$SLOT" SOFTHSM2_CONF="$SOFTHSM2_CONF" PATH="$PATH" ${LD_LIBRARY_PATH:+"LD_LIBRARY_PATH=${LD_LIBRARY_PATH}"} TESTS="$*" TEST_SUITE_LOG=run.log LOG_DRIVER_FLAGS="--verbose yes --color-tests yes" LOG_FLAGS="$log_flags" TEST_LARGE_MAP="${TEST_LARGE_MAP}" make -e check exit $? fi diff --git a/lib/dns/rbt.c b/lib/dns/rbt.c index 4cfc1769af..f845725f47 100644 --- a/lib/dns/rbt.c +++ b/lib/dns/rbt.c @@ -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); diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index 3b5035ea34..a5068d0f3a 100644 --- a/lib/dns/rbtdb.c +++ b/lib/dns/rbtdb.c @@ -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);