[bind10-dev] another bug
Francis Dupont
fdupont at isc.org
Fri Oct 7 14:07:24 UTC 2011
In src/lib/dns, still withg++ debug mode:
$ ./run_unittests --gtest_filter="Rdata_Unknown_Test.createFromText"
Note: Google Test filter = Rdata_Unknown_Test.createFromText
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from Rdata_Unknown_Test
[ RUN ] Rdata_Unknown_Test.createFromText
/usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../include/c++/4.6.1/debug/vector:313:
error: attempt to subscript container with out-of-bounds index 0, but
container only holds 0 elements.
Objects involved in the operation:
sequence "this" @ 0x0x7fff8ace1da0 {
type = NSt7__debug6vectorIhSaIhEEE;
}
Abort (core dumped)
Here the fix is trivial (and included after).
Regards
Francis Dupont <fdupont at isc.org>
--- /home/dupont/dev/bind10/src/lib/dns/rdata.cc 2011-04-14 09:15:55.000000000 +0200
+++ ./rdata.cc 2011-09-28 00:18:47.563174178 +0200
@@ -112,7 +112,9 @@
}
vector<uint8_t> data(rdata_len);
- buffer.readData(&data[0], rdata_len);
+ if (rdata_len > 0) {
+ buffer.readData(&data[0], rdata_len);
+ }
impl_ = new GenericImpl(data);
}
@@ -242,8 +244,8 @@
size_t len = (this_len < other_len) ? this_len : other_len;
int cmp;
- if ((cmp = memcmp(&lhs.data_[0], &rhs.data_[0], len))
- != 0) {
+ if ((this_len > 0) && (other_len > 0) &&
+ ((cmp = memcmp(&lhs.data_[0], &rhs.data_[0], len)) != 0)) {
return (cmp);
} else {
return ((this_len == other_len) ? 0 :
More information about the bind10-dev
mailing list