Skip to content

fix realloc crashing on linux#2

Open
markus-k wants to merge 2 commits intomindcruzer:masterfrom
markus-k:fix-realloc
Open

fix realloc crashing on linux#2
markus-k wants to merge 2 commits intomindcruzer:masterfrom
markus-k:fix-realloc

Conversation

@markus-k
Copy link

@markus-k markus-k commented Nov 8, 2024

Hi!

thank you for providing this utility, it helped a lot!

But I noticed it instantly crashes on Linux since the pointer passed to realloc was not initially allocated using malloc or calloc. So here's a quick pull request in case anyone ever needs this again.

@mindcruzer
Copy link
Owner

Hey Markus, I took a look at this I am not sure why it would be crashing for you. If you check the realloc spec it’s analogous to a call to malloc when passed a NULL pointer.

@markus-k
Copy link
Author

markus-k commented Nov 9, 2024

Huh you are right, not sure how I came to that conclusion. I had a look at it again, and the actual problem was just a missing memset on the memory allocated in read_bkn. This caused the pointer and size in read_bkn_method to be just random bytes, which caused the crash. Will fix the PR

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

Successfully merging this pull request may close these issues.

2 participants