diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2018-02-28 23:33:31 -0800 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2018-03-01 09:29:40 -0800 |
| commit | 75b8c103912f1d5a38d4f4ecb2564a0010444902 (patch) | |
| tree | 3c4d4bf250db2c16837d587aced46f153ace1f7d /src/rustllvm/RustWrapper.cpp | |
| parent | 38f4d557d0c227230a580b328ded5c06a4a20509 (diff) | |
| parent | 363d6040fdac7baa8eb18a804f02832fec5ad35f (diff) | |
| download | rust-75b8c103912f1d5a38d4f4ecb2564a0010444902.tar.gz rust-75b8c103912f1d5a38d4f4ecb2564a0010444902.zip | |
Rollup merge of #48522 - etaoins:fix-find-width-of-character-at-span-bounds-check, r=estebank
Fix find_width_of_character_at_span bounds check Commit 0bd96671f0 added bounds checking of our current target byte position to prevent infinite loops. Unfortunately it was comparing the file-relative `target` versus the global `file_start_pos` and `file_end_pos`. The result is failing to detect multibyte characters unless their file-relative offset fit within their global offset. This causes other parts of the compiler to generate spans pointing to the middle of a multibyte character which will ultimately panic in `bytepos_to_file_charpos`. Fix by comparing the `target` to the total file size when moving forward and doing checked subtraction when moving backwards. This should preserve the intent of the bounds check while removing the offset confusion. cc @davidtwco Fixes #48508
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
