Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integer overflow in allocation #1

Closed
insuyun opened this issue Feb 16, 2021 · 1 comment
Closed

Integer overflow in allocation #1

insuyun opened this issue Feb 16, 2021 · 1 comment

Comments

@insuyun
Copy link

insuyun commented Feb 16, 2021

Hi, Brian.

While doing research on allocators,
we have found that ffmalloc has an integer overflow in its allocation.

For example, this code expects to return NULL,
but in ffmalloc, due to the integer overflow in this code, it returns a valid address.

int main() {
  char* p = malloc(-8);
  printf("%p\n", p);
}
$  LD_PRELOAD=$(pwd)/ffmalloc/libffmallocnpst.so ./poc
0x55b08152c000

I think you need to have additional check before aligning the size.

Best,
Insu Yun.

@bwickman97
Copy link
Owner

Thanks Insu. I've added checks to malloc plus the various "aligned" functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants