summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2014-08-26 13:06:47 +1000
committerMichael Cahill <michael.cahill@wiredtiger.com>2014-08-26 13:06:47 +1000
commit1f8f55c79dec6402d41540d99e75519ade66b058 (patch)
tree032753f46978fcdd5c946dcf9d6dbc1c4d6f05b1 /src
parent97be49fb4e7d30601048164e0b461ee817722d1c (diff)
downloadmongo-1f8f55c79dec6402d41540d99e75519ade66b058.tar.gz
Fix the size of the value returned when stepping into log records. We skip the first byte, so we need to adjust the size.
Thanks, AddressSanitizer and valgrind! refs #1171
Diffstat (limited to 'src')
-rw-r--r--src/cursor/cur_log.c6
-rw-r--r--src/include/log.h4
-rw-r--r--src/txn/txn_log.c2
-rw-r--r--src/txn/txn_recover.c2
4 files changed, 7 insertions, 7 deletions
diff --git a/src/cursor/cur_log.c b/src/cursor/cur_log.c
index 0dc0b467185..e8516f1d3ed 100644
--- a/src/cursor/cur_log.c
+++ b/src/cursor/cur_log.c
@@ -30,7 +30,7 @@ __curlog_logrec(
* Read the log header. Set up the step pointers to walk the
* operations inside the record. Get the record type.
*/
- cl->stepp = LOG_SKIP_HEADER(cl->logrec->data, 0);
+ cl->stepp = LOG_SKIP_HEADER(cl->logrec->data);
cl->stepp_end = (uint8_t *)cl->logrec->data + logrec->size;
WT_RET(__wt_logrec_read(session, &cl->stepp, cl->stepp_end,
&cl->rectype));
@@ -172,8 +172,8 @@ __curlog_kv(WT_SESSION_IMPL *session, WT_CURSOR *cursor)
* header and the adjusted size. Add one to skip over the type
* which is normally consumed by __wt_logrec_read.
*/
- cl->opvalue->data = LOG_SKIP_HEADER(cl->logrec->data, 1);
- cl->opvalue->size = LOG_REC_SIZE(cl->logrec->size);
+ cl->opvalue->data = LOG_SKIP_HEADER(cl->logrec->data) + 1;
+ cl->opvalue->size = LOG_REC_SIZE(cl->logrec->size) - 1;
}
/*
* The log cursor sets the LSN and step count as the cursor key and
diff --git a/src/include/log.h b/src/include/log.h
index 9b6905df169..11f7f8421eb 100644
--- a/src/include/log.h
+++ b/src/include/log.h
@@ -26,8 +26,8 @@
#define LOGC_KEY_FORMAT WT_UNCHECKED_STRING(IqI)
#define LOGC_VALUE_FORMAT WT_UNCHECKED_STRING(qIIIuu)
-#define LOG_SKIP_HEADER(data, skip_rec) \
- (((const uint8_t *)(data)) + offsetof(WT_LOG_RECORD, record) + (skip_rec));
+#define LOG_SKIP_HEADER(data) \
+ ((const uint8_t *)(data) + offsetof(WT_LOG_RECORD, record))
#define LOG_REC_SIZE(size) \
((size) - offsetof(WT_LOG_RECORD, record))
diff --git a/src/txn/txn_log.c b/src/txn/txn_log.c
index 32014eba8dd..7265d9de057 100644
--- a/src/txn/txn_log.c
+++ b/src/txn/txn_log.c
@@ -426,7 +426,7 @@ __txn_printlog(
out = cookie;
- p = LOG_SKIP_HEADER(logrec->data, 0);
+ p = LOG_SKIP_HEADER(logrec->data);
end = (const uint8_t *)logrec->data + logrec->size;
/* First, peek at the log record type. */
diff --git a/src/txn/txn_recover.c b/src/txn/txn_recover.c
index 5d7de51cade..b555e6df3f9 100644
--- a/src/txn/txn_recover.c
+++ b/src/txn/txn_recover.c
@@ -270,7 +270,7 @@ __txn_log_recover(
uint32_t rectype;
r = cookie;
- p = LOG_SKIP_HEADER(logrec->data, 0);
+ p = LOG_SKIP_HEADER(logrec->data);
end = (const uint8_t *)logrec->data + logrec->size;
/* First, peek at the log record type. */