Out-of-bounds read when invalid section name is used in foot.ini #159

Closed
opened 1 year ago by craigbarnes · 1 comments
Collaborator

I was just reading the performance page on the wiki and noticed the following:

Foot recently (available from 1.5.0) gained the ability to display a render timer on-screen, which makes it easy to see how fast foot is in real time. You can try it out for yourself by setting render-timer=osd in the [tweaks] section in ~/.config/foot/foot.ini.

...so I added this to my foot.ini, just to try it out:

[tweaks]
render-timer = osd

...and got a segfault:

info: main.c:345: version: 1.5.0-38-g4ac5df0 (Oct 07 2020, branch 'master')
info: main.c:352: arch: x86_64/64-bit, 
info: config.c:1971: loading configuration from ~/.config/foot/foot.ini
 err: config.c:1668: ~/.config/foot/foot.ini:43: invalid section name: tweaks
Segmentation fault (core dumped)

Running it again with a ASan/UBSan enabled produces the following error:

info: main.c:345: version: 1.5.0-38-g4ac5df0 (Oct 07 2020, branch 'master')
info: main.c:352: arch: x86_64/64-bit, 
info: config.c:1971: loading configuration from ~/.config/foot/foot.ini
 err: config.c:1668: ~/.config/foot/foot.ini:43: invalid section name: tweaks
../config.c:1714:51: runtime error: index 10 out of bounds for type '<unknown> [10]'

The reason it's reported as an invalid section seems to be because the real section name is tweak (as opposed to tweaks). It starts up and works fine if I change that.

I was just reading the [performance] page on the wiki and noticed the following: > Foot recently (available from 1.5.0) gained the ability to display a render timer on-screen, which makes it easy to see how fast foot is in real time. You can try it out for yourself by setting `render-timer=osd` in the `[tweaks]` section in `~/.config/foot/foot.ini`. ...so I added this to my `foot.ini`, just to try it out: ```ini [tweaks] render-timer = osd ``` ...and got a segfault: ```none info: main.c:345: version: 1.5.0-38-g4ac5df0 (Oct 07 2020, branch 'master') info: main.c:352: arch: x86_64/64-bit, info: config.c:1971: loading configuration from ~/.config/foot/foot.ini err: config.c:1668: ~/.config/foot/foot.ini:43: invalid section name: tweaks Segmentation fault (core dumped) ``` Running it again with a ASan/UBSan enabled produces the following error: ```none info: main.c:345: version: 1.5.0-38-g4ac5df0 (Oct 07 2020, branch 'master') info: main.c:352: arch: x86_64/64-bit, info: config.c:1971: loading configuration from ~/.config/foot/foot.ini err: config.c:1668: ~/.config/foot/foot.ini:43: invalid section name: tweaks ../config.c:1714:51: runtime error: index 10 out of bounds for type '<unknown> [10]' ``` The reason it's reported as an invalid section seems to be because the real section name is `tweak` (as opposed to `tweaks`). It starts up and works fine if I change that. [performance]: https://codeberg.org/dnkl/foot/wiki/Performance
dnkl closed this issue 1 year ago
dnkl commented 1 year ago
Owner

Thanks! Crash should be fixed now. I've also updated both the wiki, and foot.ini(5).

Thanks! Crash should be fixed now. I've also updated both the wiki, and `foot.ini(5)`.
dnkl added the
bug
label 1 year ago
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.