rtorrent-ps
rtorrent-ps copied to clipboard
Fix segfault due to integer overflow in ratio_color indexing
If the x1000 ratio is large enough (in my case it was 671075384), you can get negative ratio_color index due to the overflow.
This commit avoids potential overflows inside ratio_color() and also in all places where it is called.
Previous fix (d52abd233ed2aab412ddbd4246226d14f4ee75f0, PR #112) masked the issue instead of fixing it, and didn't address all cases.
@pyroscope Could you pls review and merge this PR?