Commit 7f15521
authored
Fix build crash when compiler output is not valid UTF-8 (#8482)
* test: show the build panics on non-utf8 compiler output
bsc can print a code frame that cuts a multi-byte character in half, so the
captured stderr is not always valid utf-8. The Ok branch decodes it with
from_utf8().expect(), which panics and takes down the whole build with a byte
offset into stdout and no file name. This test feeds a truncated em dash and
reproduces the panic.
* fix: decode compiler output with from_utf8_lossy
The Ok branch used from_utf8().expect() on the captured stderr, which panics
when the output is not valid utf-8. The two sibling branches right above it
already use from_utf8_lossy. Use it here too so a truncated character turns into
a replacement character and the build keeps going instead of crashing.
* Add changelog entry for the non-UTF-8 build crash fix1 parent 44b1e81 commit 7f15521
2 files changed
Lines changed: 21 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
28 | 37 | | |
29 | 38 | | |
30 | 39 | | |
| |||
1039 | 1048 | | |
1040 | 1049 | | |
1041 | 1050 | | |
1042 | | - | |
1043 | | - | |
1044 | | - | |
| 1051 | + | |
1045 | 1052 | | |
1046 | 1053 | | |
1047 | 1054 | | |
| |||
1346 | 1353 | | |
1347 | 1354 | | |
1348 | 1355 | | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
1349 | 1366 | | |
1350 | 1367 | | |
1351 | 1368 | | |
| |||
0 commit comments