Skip to content

Commit

Permalink
PDFBOX-5917: when offset points to end of the stream then it's empty
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1922270 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
THausherr committed Dec 2, 2024
1 parent 1517eed commit f765bf5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fontbox/src/main/java/org/apache/fontbox/ttf/GlyphTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,12 @@ GlyphData getGlyph(int gid, int level) throws IOException
// read a single glyph
long[] offsets = loca.getOffsets();

if (offsets[gid] == offsets[gid + 1])
if (offsets[gid] == offsets[gid + 1] || offsets[gid] == data.getOriginalDataSize())
{
// no outline
// PDFBOX-5135: can't return null, must return an empty glyph because
// sometimes this is used in a composite glyph.
// PDFBOX-5917: offset points to end of the stream
glyph = new GlyphData();
glyph.initEmptyData();
}
Expand Down

0 comments on commit f765bf5

Please sign in to comment.