pytorch
cd81a700 - Fix buffer overflow from AddressSanitizer checks due to inaccurate bfloat16 representation of large integer (#89210)

Commit
2 years ago
Fix buffer overflow from AddressSanitizer checks due to inaccurate bfloat16 representation of large integer (#89210) Fixes #88939 The root cause of the issue is that BF16 cannot accurately represent big integer values. In the test case below, `539` as one of the corner pixel index is wrongly represented as `540` (from https://github.com/jgong5/pytorch/blob/fc60a1865eafc985217eccc0251f82014041e6a7/aten/src/ATen/native/UpSample.h#L271) and then the access out of the range with this index. Thanks to @malfet for the investigation and initial fix. I also reported an issue https://github.com/pytorch/pytorch/issues/89212 to track the issue of inaccurate integer representation of bf16 that need to be addressed in other places of PyTorch. ```python import torch def test(): arg_1 = torch.rand([1, 10, 540, 540], dtype=torch.bfloat16).clone() res = torch.nn.functional.interpolate(arg_1,2,mode='bilinear',align_corners=True) test() ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/89210 Approved by: https://github.com/malfet
Author
Committer
Parents
Loading