viable/strict/1787914523: Fix integer overflow in at::divup (#195035)
- PyTorch: 2340 events in the last 90 days
- PyTorch: 2310th Release in the last 90 days
- Previous: earlier the same day · trunk/640380d8d3a5a9dc8b6c8753e63a0660939b5ad9
What happened
at::divup(x, y) computes (x + y - 1) / y . The addition overflows for large x or y , and the result then silently rounds down instead of up — divup(2, INT64_MAX) returns 0 , not 1 . Guarded with c10::add_overflows , falling back to a form that cannot overflow. Every caller today passes loop extents and chunk counts, so for most of them this is latent. One caller does reach it: PoolingParams1D::valid_output_end bound…
Summary assembled by rule from the sources below