Skip to content
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

Index out of range when rasterizing '|' on Source Code Pro with Freetype #23

Closed
zacps opened this issue Dec 23, 2018 · 3 comments
Closed

Comments

@zacps
Copy link
Contributor

zacps commented Dec 23, 2018

There may be more cases to reproduce this, but this is easily repeatable:

Complete backtrace
thread 'main' panicked at 'index 89 out of range for slice of length 88', src/libcore/slice/mod.rs:2349:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:59
             at src/libstd/panicking.rs:210
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:225
   4: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:488
   5: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:395
   6: rust_begin_unwind
             at src/libstd/panicking.rs:322
   7: core::panicking::panic_fmt
             at src/libcore/panicking.rs:95
   8: core::slice::slice_index_len_fail
             at src/libcore/slice/mod.rs:2349
   9: <core::ops::range::Range<usize> as core::slice::SliceIndex<[T]>>::index
             at /rustc/96d1334e567237b1507cd277938e7ae2de75ff51/src/libcore/slice/mod.rs:2514
  10: core::slice::<impl core::ops::index::Index<I> for [T]>::index
             at /rustc/96d1334e567237b1507cd277938e7ae2de75ff51/src/libcore/slice/mod.rs:2331
  11: font_kit::canvas::Canvas::blit_from_with
             at /home/zac/projects/font-kit/src/canvas.rs:153
  12: font_kit::canvas::Canvas::blit_from
             at /home/zac/projects/font-kit/src/canvas.rs:89
  13: font_kit::loaders::freetype::Font::rasterize_glyph
             at /home/zac/projects/font-kit/src/loaders/freetype.rs:754
  14: <font::fontkit::FontKitRasterizer as font::Rasterize>::get_glyph
             at font/src/fontkit/mod.rs:144
  15: alacritty::renderer::GlyphCache::get::{{closure}}
             at src/renderer/mod.rs:276
  16: <std::collections::hash::map::Entry<'a, K, V>>::or_insert_with
             at /rustc/96d1334e567237b1507cd277938e7ae2de75ff51/src/libstd/collections/hash/map.rs:2695
  17: alacritty::renderer::GlyphCache::get
             at src/renderer/mod.rs:273
  18: alacritty::renderer::GlyphCache::load_glyphs_for_font
             at src/renderer/mod.rs:204
  19: alacritty::renderer::GlyphCache::new
             at src/renderer/mod.rs:195
  20: alacritty::display::Display::new_glyph_cache::{{closure}}
             at src/display.rs:250
  21: alacritty::renderer::QuadRenderer::with_loader
             at src/renderer/mod.rs:713
  22: alacritty::display::Display::new_glyph_cache
             at src/display.rs:250
  23: alacritty::display::Display::new
             at src/display.rs:156
  24: alacritty::run
             at src/main.rs:127
  25: alacritty::main
             at src/main.rs:79
  26: std::rt::lang_start::{{closure}}
             at /rustc/96d1334e567237b1507cd277938e7ae2de75ff51/src/libstd/rt.rs:74
  27: std::panicking::try::do_call
             at src/libstd/rt.rs:59
             at src/libstd/panicking.rs:307
  28: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:102
  29: std::rt::lang_start_internal
             at src/libstd/panicking.rs:286
             at src/libstd/panic.rs:398
             at src/libstd/rt.rs:58
  30: std::rt::lang_start
             at /rustc/96d1334e567237b1507cd277938e7ae2de75ff51/src/libstd/rt.rs:74
  31: main
  32: __libc_start_main
  33: _start

Logging values in the loop:

Start 0 width 3 bytes 3 len 88
Start 8 width 3 bytes 3 len 88
Start 16 width 3 bytes 3 len 88
Start 24 width 3 bytes 3 len 88
Start 32 width 3 bytes 3 len 88
Start 40 width 3 bytes 3 len 88
Start 48 width 3 bytes 3 len 88
Start 56 width 3 bytes 3 len 88
Start 64 width 3 bytes 3 len 88
Start 72 width 3 bytes 3 len 88
Start 80 width 3 bytes 3 len 88
<panic 89 out of range>
@zacps
Copy link
Contributor Author

zacps commented Dec 23, 2018

Also occurs using DejaVu Sans Mono, glyph 77 char j.

@evilpie
Copy link
Contributor

evilpie commented May 26, 2019

I tried to reproduce this using the render-glyph example/tool and it didn't crash.

@pcwalton
Copy link
Contributor

pcwalton commented Jan 9, 2020

Neither of these crash for me, so I'm closing. Feel free to reopen if you have a test case.

@pcwalton pcwalton closed this as completed Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants