fail earlier if record_type and record_size apis are abused

This commit is contained in:
Sears Russell 2009-04-01 21:12:50 +00:00
parent 564dfe426b
commit 83a982d0bf
2 changed files with 7 additions and 2 deletions

View file

@ -36,7 +36,7 @@ static int initted = 0;
const recordid ROOT_RECORD = {1, 0, -1};
const recordid NULLRID = {0,0,-1};
const short SLOT_TYPE_LENGTHS[] = { 0, 0, sizeof(blob_record_t), -1};
const short SLOT_TYPE_LENGTHS[] = { -1, -1, sizeof(blob_record_t), -1};
/**
Locking for transactional2.c works as follows:

View file

@ -489,7 +489,12 @@ static const size_t USABLE_SIZE_OF_PAGE = (PAGE_SIZE - sizeof(lsn_t) - sizeof(in
*/
static inline size_t
stasis_record_type_to_size(ssize_t type) {
return type >= 0 ? type : SLOT_TYPE_LENGTHS[0 - type];
if(type >= 0) {
return type;
} else {
assert(SLOT_TYPE_LENGTHS[0 - type] >= 0);
return SLOT_TYPE_LENGTHS[0 - type];
}
}
/**