Fix scrollbar int overflow in drag handling#315
Fix scrollbar int overflow in drag handling#315lhecker merged 2 commits intomicrosoft:mainfrom L1quidH2O:scrollbar-fix
Conversation
For large files, `delta_y * scrollable_height` can cause an int overflow, resulting in a negative `scroll_offset` and broken behavior. This PR fixes it by casting to f32 for calculation.
|
I'll reject this PR, because I believe it's better to change the FWIW casting to a |
|
I agree with changing |
|
The max. file size supported on 32-Bit versions is 128MiB. It should be quite difficult to exceed the 32-Bit range with that, unless I'm thinking about it incorrectly. |
Oh, and what I actually wanted to say with my comment is that we should be using |
|
I think you misunderstood the problem, |
|
I've updated my branch to use |
|
I did understand the problem, but I forgot that |
|
FWIW I still don't particularly like the usage of Of course, fixing this bug takes priority though. |
|
I should also say that I'm grateful that you corrected me. I apologize that I made it difficult. |
For large files,
delta_y * scrollable_heightcan cause an int overflow, resulting in a negativescroll_offsetand broken behavior. This PR fixes it by casting to f32 for calculation.Broken Demo:
Scroll bar doesn't make it to the end of the file and jumps back to 0
broken.mp4
Fixed Demo:
Scroll bar continues normally
fixed.mp4