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

Malloc returned values doesn't checked #13099

Open
NoamRabi20 opened this issue Oct 29, 2024 · 2 comments
Open

Malloc returned values doesn't checked #13099

NoamRabi20 opened this issue Oct 29, 2024 · 2 comments
Labels
up-for-grabs Up for grabs

Comments

@NoamRabi20
Copy link

Note: Please use Issues only for bug reports. For questions, discussions, feature requests, etc. post to dev group: https://groups.google.com/forum/#!forum/rocksdb or https://www.facebook.com/groups/rocksdb.dev

Expected behavior

Malloc return values should be verified, and in case of unsuccessful malloc, error should be propagate

Actual behavior

unsuccessful malloc will return null, and the following action will cause crash

Steps to reproduce the behavior

run on low memory system

###examples
db/c.cc (7 instances)
cache/lru.cache.cc (2 instances)

@gitlijian
Copy link

gitlijian commented Nov 6, 2024

hi, @NoamRabi20 Is this the way to modify it? If possible, I will perform exception detection at each call to malloc.
image

@NoamRabi20
Copy link
Author

yes, this is good approach, just need to make sure at each call how the code handle errors (return null in this specific case) it may be different between calls

@cbi42 cbi42 added the up-for-grabs Up for grabs label Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
up-for-grabs Up for grabs
Projects
None yet
Development

No branches or pull requests

3 participants