[riot-notifications] [RIOT-OS/RIOT] sys/ps: Improve robustness against string table errors. (#10977)
Juan I Carrano
notifications at github.com
Fri Feb 8 18:35:28 CET 2019
### Contribution description
This PR was motivated by #10967 : while we can't be sure that such a problem won't happen again, at least it's consequences can be mitigated.
The mapping from thread state codes to a human readable string in the PS modules has to be maintained manually. There is a very real possibility for it to get out of sync with the actual defined states, which would cause a crash when a lookup with an out of bounds index is performed. Also, because
of the way the array is defined, there could be gaps (which will be filled by nulls).
This patch replaces the array looukup by a function that checks bounds and also triggers an assertion so that the issue can be caught during development.
### Testing procedure
Follow the proceduce outlined in #10967 (patch `examples/default` with @maribu's patch).
With assertions enabled, you should get one. Without assertions, the status of the crasher thread will show up as "unknown".
### Issues/PRs references
You can view, comment on, or merge this pull request online at:
-- Commit Summary --
* sys/ps: Improve robustness against string table errors.
-- File Changes --
M sys/ps/ps.c (25)
-- Patch Links --
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the notifications