-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bail out from rendering when bitmap_buffer is null #197
Merged
+7
−0
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@bors r+ Seems like an okay fix, though I'm not that clear on this codebase |
@bors-servo r+ |
📌 Commit 3bb66f3 has been approved by |
bors-servo
added a commit
that referenced
this pull request
May 24, 2023
Bail out from rendering when bitmap_buffer is null I don't really understand what's going on here. All I really know is that I ran into one of the standard library's debug assertions when running some of the examples in `plotters`. I trimmed one down, but not a whole lot. ```rust use plotters::prelude::*; fn main() { let mut buffer = vec![0u8; 1024 * 768 * 3]; let area = BitMapBackend::with_buffer(&mut buffer[..], (1024, 768)) .into_drawing_area() .split_evenly((1, 2)); let _chart = ChartBuilder::on(&area[0]) .caption("Incremental Example", ("sans-serif", 20)) .build_cartesian_2d(0..10, 0..10) .expect("Unable to build ChartContext"); } ``` Running this example without this patch using `cargo +nightly run -Zbuild-std --target=x86_64-unknown-linux-gnu` will panic: ``` thread 'main' panicked at '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`', /home/ben/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panicking.rs:126:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace thread caused non-unwinding panic. aborting. Aborted (core dumped) ``` The problem is that the pointer is null.
Needs a rustfmt run |
💥 Test timed out |
Manishearth
approved these changes
May 24, 2023
@bors-servo r+ |
📌 Commit 787b68f has been approved by |
bors-servo
added a commit
that referenced
this pull request
May 24, 2023
Bail out from rendering when bitmap_buffer is null I don't really understand what's going on here. All I really know is that I ran into one of the standard library's debug assertions when running some of the examples in `plotters`. I trimmed one down, but not a whole lot. ```rust use plotters::prelude::*; fn main() { let mut buffer = vec![0u8; 1024 * 768 * 3]; let area = BitMapBackend::with_buffer(&mut buffer[..], (1024, 768)) .into_drawing_area() .split_evenly((1, 2)); let _chart = ChartBuilder::on(&area[0]) .caption("Incremental Example", ("sans-serif", 20)) .build_cartesian_2d(0..10, 0..10) .expect("Unable to build ChartContext"); } ``` Running this example without this patch using `cargo +nightly run -Zbuild-std --target=x86_64-unknown-linux-gnu` will panic: ``` thread 'main' panicked at '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`', /home/ben/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panicking.rs:126:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace thread caused non-unwinding panic. aborting. Aborted (core dumped) ``` The problem is that the pointer is null.
💥 Test timed out |
Something wrong with macos builders |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I don't really understand what's going on here. All I really know is that I ran into one of the standard library's debug assertions when running some of the examples in
plotters
. I trimmed one down, but not a whole lot.Running this example without this patch using
cargo +nightly run -Zbuild-std --target=x86_64-unknown-linux-gnu
will panic:The problem is that the pointer is null.