take canaries into account for the offset test
This commit is contained in:
parent
71d52d981e
commit
9b7691a2a7
@ -17,10 +17,15 @@ static const unsigned size_classes[] = {
|
|||||||
|
|
||||||
#define N_SIZE_CLASSES (sizeof(size_classes) / sizeof(size_classes[0]))
|
#define N_SIZE_CLASSES (sizeof(size_classes) / sizeof(size_classes[0]))
|
||||||
|
|
||||||
|
static size_t canary_size = 8;
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
void *p[N_SIZE_CLASSES];
|
void *p[N_SIZE_CLASSES];
|
||||||
for (unsigned i = 0; i < N_SIZE_CLASSES; i++) {
|
for (unsigned i = 0; i < N_SIZE_CLASSES; i++) {
|
||||||
unsigned size = size_classes[i];
|
unsigned size = size_classes[i];
|
||||||
|
if (size) {
|
||||||
|
size -= canary_size;
|
||||||
|
}
|
||||||
p[i] = malloc(size);
|
p[i] = malloc(size);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user