GithubHelp home page GithubHelp logo

Comments (1)

johnoneil avatar johnoneil commented on September 28, 2024

Yeah I'm seeing this as well.
The origin of the issue (at least for me) seems to be in attempting to get an outline for a glyph with no geometry (say for example a space).
This case can be reproduced via the glyph_outline example without changes via:

cargo run --example glyph_outline examples/assets/FiraSans-Regular.ttf ' '

Here I'm passing a space as the outlined character (unicode codepoint 0x20 or 32 decimal).

I've caught this in the debugger and it appears a null ptr check is needed in the following code in outline.rs

impl<'a> Iterator for ContourIterator<'a> {
    type Item = CurveIterator<'a>;

    fn next(&mut self) -> Option<Self::Item> {
        if self.contour_end_idx > self.last_end_idx {
            None
        } else {
            unsafe {
                let contour_end = *self.contour_end_idx; // <-- dereferncing a null ptr here !!!
                let curves = CurveIterator::from_raw(self.outline, self.contour_start as isize,
                                                     contour_end as isize);
                self.contour_start = contour_end + 1;
                self.contour_end_idx = self.contour_end_idx.offset(1);

                Some(curves)
            }
        }
    }
}

I could provide a PR for this as it would improve out client which is using this crate, but as you know the binding better I'll accept how you want to proceed on this.

from freetype-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.