pebble-dev / RebbleOS

open source operating system for low-power smartwatches
Other
365 stars 38 forks source link

WIP: Improve Resource Sanity Checking #96

Closed AliceGrey closed 4 years ago

AliceGrey commented 4 years ago

Removed 200K hard limit for resources. Should be checking the size of available heap and comparing it to the resource size.

jwise commented 4 years ago

Good catch! This logic was originally to check if resources "looked" corrupt on flash, but this makes it even more precise. Another way to do this would be by just letting the malloc() fail, rather than reaching into the allocator, but this is more explicit, to be sure. I left a few comments.

AliceGrey commented 4 years ago

Made changes based on comments. We now return if the check fails and removed the debug logging I accidentally left in there.

jwise commented 4 years ago

LGTM! Thanks!