You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I guess this could arise if a font has a 'stch' feature where the substitution "decomposes" a glyph to a single glyph (rather than the expected sequence of 3 or even 5 glyphs), so there's no repeating element. That seems like a rather pointless use of the feature, but isn't technically invalid AFAICS.
I'm not sure offhand whether we'd actually reach this code with such a font (or if we'd short-circuit somewhere earlier), but it seems like it'd be worth including a zero-check here to be on the safe side.
Coverity also detected this, but I think it’s a false positive. Here’s a copy/paste of my analysis from the Coverity issue:
n_copies can be proven to be non-zero on all code paths up to this point. If n_repeating is zero, that means w_repeating has never been added to, so (w_repeating == 0). We must have (shortfall > 0), so (sign * w_remaining > 0). This means that (excess < 0), which invalidates the if-condition on line 547.
I checked the code and I also think this cannot happen, because excess > 0 implies w_repeating != 0 which implies n_repeating != 0. But happy to take a simple fix to silence the error. Doing so.
Hi,
I ran the clang static analyzer on harfbuzz 1.4.2 and it reported this potential issue:
So basically if n_repeating is zero this could crash, which should be easy to address.
Thanks,
Ben
The text was updated successfully, but these errors were encountered: