rtorrent-ps icon indicating copy to clipboard operation
rtorrent-ps copied to clipboard

Fix segfault due to integer overflow in ratio_color indexing

Open tvasenin opened this issue 6 years ago • 1 comments

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.

tvasenin avatar Dec 26 '19 14:12 tvasenin

@pyroscope Could you pls review and merge this PR?

tvasenin avatar Oct 11 '20 09:10 tvasenin