Skip to content

Prevent underflow in heap size calculation #3898

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

Merged
merged 1 commit into from
Mar 9, 2017

Conversation

c1728p9
Copy link
Contributor

@c1728p9 c1728p9 commented Mar 6, 2017

If the free memory on a device is small enough then the calculation to determine heap size could underflow to a large value. If this happens then malloc will never return failure and instead will cause a crash on allocation. This patch prevents the underflow so malloc works as expected even with low amounts of free memory.

This resolves #3210

If the free memory on a device is small enough then the calculation to
determine heap size could underflow to a large value. If this happens
then malloc will never return failure and instead will cause a crash on
allocation. This patch prevents the underflow so malloc works as
expected even with low amounts of free memory.
@0xc0170
Copy link
Contributor

0xc0170 commented Mar 7, 2017

/morph test

@mbed-bot
Copy link

mbed-bot commented Mar 7, 2017

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 1649

All builds and test passed!

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 7, 2017

continuous-integration/jenkins/pr-head — Waiting for status to be reported

Seems not working? @c1728p9 Please check later, and we shall restart it

@0xc0170 0xc0170 closed this Mar 9, 2017
@0xc0170 0xc0170 reopened this Mar 9, 2017
@0xc0170
Copy link
Contributor

0xc0170 commented Mar 9, 2017

@marhil01 Can you please restart jenkins? It can't access it via github.

@0xc0170 0xc0170 merged commit fefa91f into ARMmbed:master Mar 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[mbed-os rtos]: set_stack_heap() calculates wrong heap size when heap size is low
3 participants