pebble-dev / RebbleOS

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

Resource loader doesn't check any errors #49

Open ginge opened 6 years ago

ginge commented 6 years ago

The resource loader currently is very optimistic. If there is an issue with a resource (say we packed the wrong image ID) and we try and load id, it can cause all kinds of crashes as we try and malloc 1GB of memory.

Add some checks to the size of loaded resources. They should be no larger that the applications current heap, and even better the free memory in the current heap (This is a little harder to implement)

Even when size sanity checks look ok, check the resource loader return values: