Closed ruifengx closed 1 year ago
Update: this crash cannot be reproduced using the latest version of swash
(0.1.8). However, this might still be an interesting case to investigate (if it is not already known), because usually upgrading the compiler should not change program semantics.
Appear to be a duplicate of #34.
because usually upgrading the compiler should not change program semantics.
In this case in particular, the program was containing undefined-behaviour, whose semantics may indeed change between versions.
Indeed, it looks like the compiler managed to exploit a previously-unnoticed UB. Since it is already known and fixed in the latest version, I will close this issue now. Thanks for your explanation.
I experienced this crash after upgrading
rustc
to 1.70.0, and I cannot reproduce it usingrustc
1.69.0. The crash happens in aniced
application (with a dependency onswash
0.1.6).The full crash log is attached here for your information. It seems there is something wrong about the font parsing process. I tested the application in Windows Sandbox (which comes with only the fonts that Microsoft ships with Windows), so the issue should not be about the custom fonts I installed.
Full crash log
```text thread 'main' panicked at 'misaligned pointer dereference: address must be a multiple of 0x2 but is 0x25ace2382a5', $HOME\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd\swash-0.1.6\src\internal\parse.rs:452:13 stack backtrace: 0: std::panicking::begin_panic_handler at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\panicking.rs:578 1: core::panicking::panic_fmt at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\core\src\panicking.rs:67 2: core::panicking::panic_misaligned_pointer_dereference at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\core\src\panicking.rs:174 3: swash::internal::parse::impl$9::from_be_data_unchecked at $HOME\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd\swash-0.1.6\src\internal\parse.rs:452 4: swash::internal::parse::FromBeData::from_be_data at $HOME\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd\swash-0.1.6\src\internal\parse.rs:424 5: swash::internal::parse::Bytes::read at $HOME\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd\swash-0.1.6\src\internal\parse.rs:55 6: swash::scale::cff::cff::IndexMetadata::unpack at $HOME\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd\swash-0.1.6\src\scale\cff\cff.rs:1191 7: swash::scale::cff::cff::Index::new at $HOME\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd\swash-0.1.6\src\scale\cff\cff.rs:1226 8: swash::scale::cff::cff::CffProxy::parse at $HOME\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd\swash-0.1.6\src\scale\cff\cff.rs:92 9: swash::scale::cff::cff::CffProxy::from_font at $HOME\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd\swash-0.1.6\src\scale\cff\cff.rs:54 10: swash::scale::proxy::ScalerProxy::from_font at $HOME\.cargo\registry\src\mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd\swash-0.1.6\src\scale\proxy.rs:28 11: swash::scale::impl$3::new::closure$0The crash can be consistently reproduced on my PC with the following simple program:
with the following in
Cargo.toml
configuration (to useiced
master):I have already filed iced-rs/iced#1905, but I feel that this is more related to
swash
, so I also file a copy here.