Open HyperCodec opened 2 months ago
Related:
https://github.com/rust-lang/rust/issues/123285 https://github.com/alacritty/alacritty/issues/7736
This is triggered by caption. My traceback for the default 3d example https://plotters-rs.github.io/book/basic/draw_3d_plots.html
unsafe precondition(s) violated: slice::from_raw_parts requires the pointer to be aligned and non-null, and the total size of the slice not to exceed `isize::MAX`
stack backtrace:
0: rust_begin_unwind
at /rustc/a07f3eb43acc5df851e15176c7081a900a30a4d7/library/std/src/panicking.rs:645:5
1: core::panicking::panic_nounwind_fmt::runtime
at /rustc/a07f3eb43acc5df851e15176c7081a900a30a4d7/library/core/src/panicking.rs:110:18
2: core::panicking::panic_nounwind_fmt
at /rustc/a07f3eb43acc5df851e15176c7081a900a30a4d7/library/core/src/panicking.rs:120:5
3: core::panicking::panic_nounwind
at /rustc/a07f3eb43acc5df851e15176c7081a900a30a4d7/library/core/src/panicking.rs:215:5
4: core::slice::raw::from_raw_parts::precondition_check
at /rustc/a07f3eb43acc5df851e15176c7081a900a30a4d7/library/core/src/ub_checks.rs:66:21
5: core::slice::raw::from_raw_parts
at /rustc/a07f3eb43acc5df851e15176c7081a900a30a4d7/library/core/src/slice/raw.rs:96:9
6: font_kit::loaders::freetype::Font::rasterize_glyph
at /home/peter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/font-kit-0.11.0/src/loaders/freetype.rs:847:26
7: <plotters::style::font::ttf::FontDataInternal as plotters::style::font::FontData>::draw
at /home/peter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/plotters-0.3.5/src/style/font/ttf.rs:265:26
8: plotters::style::font::font_desc::FontDesc::draw
at /home/peter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/plotters-0.3.5/src/style/font/font_desc.rs:168:29
9: <plotters::style::text::TextStyle as plotters_backend::text::BackendTextStyle>::draw
at /home/peter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/plotters-0.3.5/src/style/text.rs:322:9
10: plotters_backend::DrawingBackend::draw_text
at /home/peter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/plotters-backend-0.3.5/src/lib.rs:250:15
11: plotters::drawing::area::DrawingArea<DB,plotters::coord::Shift>::titled::{{closure}}
at /home/peter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/plotters-0.3.5/src/drawing/area.rs:496:13
12: plotters::drawing::area::DrawingArea<DB,CT>::backend_ops
at /home/peter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/plotters-0.3.5/src/drawing/area.rs:282:13
13: plotters::drawing::area::DrawingArea<DB,plotters::coord::Shift>::titled
at /home/peter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/plotters-0.3.5/src/drawing/area.rs:495:9
14: plotters::chart::builder::ChartBuilder<DB>::build_cartesian_3d
at /home/peter/.cargo/registry/src/index.crates.io-6f17d22bba15001f/plotters-0.3.5/src/chart/builder.rs:475:28
15: hexglobe::goldberg_polyhedron::plotting_test::can_make_plot
at ./src/goldberg_polyhedron/plotting_test.rs:11:21
16: hexglobe::goldberg_polyhedron::plotting_test::can_make_plot::{{closure}}
at ./src/goldberg_polyhedron/plotting_test.rs:6:23
17: core::ops::function::FnOnce::call_once
at /rustc/a07f3eb43acc5df851e15176c7081a900a30a4d7/library/core/src/ops/function.rs:250:5
18: core::ops::function::FnOnce::call_once
at /rustc/a07f3eb43acc5df851e15176c7081a900a30a4d7/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread caused non-unwinding panic. aborting.
error: test failed, to rerun pass `--lib`
It appears that the test suite doesnt cover this - running cargo test --all-features
in this repo doesnt trigger it...?
I think the bug is fixed on master
Seems that even the fix has broken plotters
.
I get no spacing between the text now, when I used the latest git commit:
Seems that even the fix has broken plotters. I get no spacing between the text now, when I used the latest git commit
I see the same thing.
However there was no "fix" for this issue - it was already fixed on master
, so some other change has caused this.
So I've created https://github.com/plotters-rs/plotters/issues/576
Seems that even the fix has broken plotters. I get no spacing between the text now, when I used the latest git commit
I see the same thing. However there was no "fix" for this issue - it was already fixed on
master
, so some other change has caused this. So I've created https://github.com/plotters-rs/plotters/issues/576
Thank you for your response. From the back traces so that it was related to fonts so my line of thought is that it could be related to some extent. Honesty, however, I haven't looked at plottes code in any way so it's a shot in the dark 😅
I got the same error, seems like using spaces in captions or labels triggers that. Currently I'm using plotters 0.3.5 in Linux Mint.
I have the same problem when I use the lib under docker bookworm with rust 1.78 but the problem doesn't appear on MacOS.
While waiting for the patch, I've found an alternative which consists in using the SVGBackend and not the BitmapBackend. Apparently the bug is linked specifically to BitMapBackend.
After all, SVG renderings are of better quality.
I have the same problem when I use the lib under docker bookworm with rust 1.78 but the problem doesn't appear on MacOS.
While waiting for the patch, I've found an alternative which consists in using the SVGBackend and not the BitmapBackend. Apparently the bug is linked specifically to BitMapBackend.
After all, SVG renderings are of better quality.
This workaround worked for me, will still keep the issue open though as a reference point for the larger BitmapBackend problem.
Looks like this bug was fixed in font-kit a year ago, https://github.com/servo/font-kit/commit/787b68f69662e5acca6913db072bcc294c0a1e09 Not sure why plotters still depends on outdated font-kit version
plotters master
doesnt have this problem, and has an updated font-kit. We need a new release. See https://github.com/orgs/plotters-rs/discussions/577
I'm getting the same error on next-release-devel
(trying to use that because I'm running into #551 )
Describe the bug I start to get this error on
build_cartesian_2d
:To Reproduce Here's everything I have that is related to this crate:
Version Information
plotters = "0.3.5"