You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Matt Davis (JIRA)" <ji...@apache.org> on 2010/07/20 17:41:49 UTC
[jira] Created: (PDFBOX-780) EXCEPTION_ACCESS_VIOLATION in
fontmanager.so/fontmanager.dll
EXCEPTION_ACCESS_VIOLATION in fontmanager.so/fontmanager.dll
------------------------------------------------------------
Key: PDFBOX-780
URL: https://issues.apache.org/jira/browse/PDFBOX-780
Project: PDFBox
Issue Type: Bug
Environment: redhat linux rhel5 and windows xp
Reporter: Matt Davis
It seems when writing a PDF that has an invalid embedded font to an image there is a crash in the native function sun.font.FileFont.getGlyphImage(JI). It can be reproduced using the PDFToImage program on a pdf with an invalid embedded font.
Turing on -Dsun.java2d.debugfonts=true on a bad pdf will show some like the follow for the bad font
INFO: open TTF: C:\DOCUME~1\mdavis\LOCALS~1\Temp\+~JF4968602841241472406.tmp
Jul 20, 2010 11:37:31 AM sun.font.TrueTypeGlyphMapper handleBadCMAP
SEVERE: Null Cmap for ** TrueType Font: Family=INKLBC+SymbolMT Name=INKLBC+SymbolMT style=0 fileName=C:\DOCUME~1\mdavis\LOCALS~1\Temp\+~JF4968602841241472406.tmpsubstituting for this font
Jul 20, 2010 11:37:31 AM sun.font.FontManager deRegisterBadFont
SEVERE: Deregister bad font: ** TrueType Font: Family=INKLBC+SymbolMT Name=INKLBC+SymbolMT style=0 fileName=C:\DOCUME~1\mdavis\LOCALS~1\Temp\+~JF4968602841241472406.tmp
Jul 20, 2010 11:37:31 AM sun.font.FileFontStrike <init>
INFO: Strike for ** TrueType Font: Family=INKLBC+SymbolMT Name=INKLBC+SymbolMT style=0 fileName=C:\DOCUME~1\mdavis\LOCALS~1\Temp\+~JF4968602841241472406.tmp at size = 19 use natives = false useJavaRasteriser = true AAHint = 2 Has Embedded bitmaps = false
The following code in PDSimpleFont.java seems to fix the crash although I am not sure if it is correct:
public void drawString(String string, Graphics g, float fontSize, AffineTransform at, float x, float y) throws IOException {
Font _awtFont = getawtFont();
//mdavis - fix fontmanager.so/dll on sun.font.FileFont.getGlyphImage for font with bad cmaps?
if (_awtFont.canDisplayUpTo(string) != -1) {
log.warn("Changing fonts on <" + string + "> from <" + _awtFont.getName() + "> to default font");
_awtFont = null;
}
Graphics2D g2d = (Graphics2D) g;
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (PDFBOX-780) EXCEPTION_ACCESS_VIOLATION in
fontmanager.so/fontmanager.dll
Posted by "Craig Stires (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PDFBOX-780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12900953#action_12900953 ]
Craig Stires commented on PDFBOX-780:
-------------------------------------
Confirm that this fixes a SIGSEGV on Windows and Ubuntu for the same problem in PDSimpleFont:drawString()
However, the fix starts causing NPE dumps to be thrown three lines later, in the writeFont method
the call arrives as:
PDSimpleFont.java (109)
writeFont(g2d, at, _awtFont==null, fontSize, x, y, string);
and throws the NPE in the writeFont code (2 places)
PDSimpleFont.java (379,397)
g2d.setFont(awtFont.deriveFont(fontSize));
g2d.setFont(awtFont.deriveFont( at ).deriveFont(fontSize));
Should we do the check for ( _awtFont != null ) before calling writeFont, or should we catch this at the start of the writeFont method and return?
> EXCEPTION_ACCESS_VIOLATION in fontmanager.so/fontmanager.dll
> ------------------------------------------------------------
>
> Key: PDFBOX-780
> URL: https://issues.apache.org/jira/browse/PDFBOX-780
> Project: PDFBox
> Issue Type: Bug
> Environment: redhat linux rhel5 and windows xp
> Reporter: Matt Davis
> Assignee: Jukka Zitting
> Fix For: 1.3.0
>
> Attachments: test.pdf
>
>
> It seems when writing a PDF that has an invalid embedded font to an image there is a crash in the native function sun.font.FileFont.getGlyphImage(JI). It can be reproduced using the PDFToImage program on a pdf with an invalid embedded font.
> Turing on -Dsun.java2d.debugfonts=true on a bad pdf will show some like the follow for the bad font
> INFO: open TTF: C:\DOCUME~1\mdavis\LOCALS~1\Temp\+~JF4968602841241472406.tmp
> Jul 20, 2010 11:37:31 AM sun.font.TrueTypeGlyphMapper handleBadCMAP
> SEVERE: Null Cmap for ** TrueType Font: Family=INKLBC+SymbolMT Name=INKLBC+SymbolMT style=0 fileName=C:\DOCUME~1\mdavis\LOCALS~1\Temp\+~JF4968602841241472406.tmpsubstituting for this font
> Jul 20, 2010 11:37:31 AM sun.font.FontManager deRegisterBadFont
> SEVERE: Deregister bad font: ** TrueType Font: Family=INKLBC+SymbolMT Name=INKLBC+SymbolMT style=0 fileName=C:\DOCUME~1\mdavis\LOCALS~1\Temp\+~JF4968602841241472406.tmp
> Jul 20, 2010 11:37:31 AM sun.font.FileFontStrike <init>
> INFO: Strike for ** TrueType Font: Family=INKLBC+SymbolMT Name=INKLBC+SymbolMT style=0 fileName=C:\DOCUME~1\mdavis\LOCALS~1\Temp\+~JF4968602841241472406.tmp at size = 19 use natives = false useJavaRasteriser = true AAHint = 2 Has Embedded bitmaps = false
> The following code in PDSimpleFont.java seems to fix the crash although I am not sure if it is correct:
> public void drawString(String string, Graphics g, float fontSize, AffineTransform at, float x, float y) throws IOException {
> Font _awtFont = getawtFont();
>
>
> //mdavis - fix fontmanager.so/dll on sun.font.FileFont.getGlyphImage for font with bad cmaps?
> if (_awtFont.canDisplayUpTo(string) != -1) {
> log.warn("Changing fonts on <" + string + "> from <" + _awtFont.getName() + "> to default font");
> _awtFont = null;
> }
>
> Graphics2D g2d = (Graphics2D) g;
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (PDFBOX-780) EXCEPTION_ACCESS_VIOLATION in
fontmanager.so/fontmanager.dll
Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PDFBOX-780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jukka Zitting resolved PDFBOX-780.
----------------------------------
Assignee: Jukka Zitting
Fix Version/s: 1.3.0
Resolution: Fixed
Thanks! Fixed as suggested in revision 983634.
> EXCEPTION_ACCESS_VIOLATION in fontmanager.so/fontmanager.dll
> ------------------------------------------------------------
>
> Key: PDFBOX-780
> URL: https://issues.apache.org/jira/browse/PDFBOX-780
> Project: PDFBox
> Issue Type: Bug
> Environment: redhat linux rhel5 and windows xp
> Reporter: Matt Davis
> Assignee: Jukka Zitting
> Fix For: 1.3.0
>
> Attachments: test.pdf
>
>
> It seems when writing a PDF that has an invalid embedded font to an image there is a crash in the native function sun.font.FileFont.getGlyphImage(JI). It can be reproduced using the PDFToImage program on a pdf with an invalid embedded font.
> Turing on -Dsun.java2d.debugfonts=true on a bad pdf will show some like the follow for the bad font
> INFO: open TTF: C:\DOCUME~1\mdavis\LOCALS~1\Temp\+~JF4968602841241472406.tmp
> Jul 20, 2010 11:37:31 AM sun.font.TrueTypeGlyphMapper handleBadCMAP
> SEVERE: Null Cmap for ** TrueType Font: Family=INKLBC+SymbolMT Name=INKLBC+SymbolMT style=0 fileName=C:\DOCUME~1\mdavis\LOCALS~1\Temp\+~JF4968602841241472406.tmpsubstituting for this font
> Jul 20, 2010 11:37:31 AM sun.font.FontManager deRegisterBadFont
> SEVERE: Deregister bad font: ** TrueType Font: Family=INKLBC+SymbolMT Name=INKLBC+SymbolMT style=0 fileName=C:\DOCUME~1\mdavis\LOCALS~1\Temp\+~JF4968602841241472406.tmp
> Jul 20, 2010 11:37:31 AM sun.font.FileFontStrike <init>
> INFO: Strike for ** TrueType Font: Family=INKLBC+SymbolMT Name=INKLBC+SymbolMT style=0 fileName=C:\DOCUME~1\mdavis\LOCALS~1\Temp\+~JF4968602841241472406.tmp at size = 19 use natives = false useJavaRasteriser = true AAHint = 2 Has Embedded bitmaps = false
> The following code in PDSimpleFont.java seems to fix the crash although I am not sure if it is correct:
> public void drawString(String string, Graphics g, float fontSize, AffineTransform at, float x, float y) throws IOException {
> Font _awtFont = getawtFont();
>
>
> //mdavis - fix fontmanager.so/dll on sun.font.FileFont.getGlyphImage for font with bad cmaps?
> if (_awtFont.canDisplayUpTo(string) != -1) {
> log.warn("Changing fonts on <" + string + "> from <" + _awtFont.getName() + "> to default font");
> _awtFont = null;
> }
>
> Graphics2D g2d = (Graphics2D) g;
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (PDFBOX-780) EXCEPTION_ACCESS_VIOLATION in
fontmanager.so/fontmanager.dll
Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PDFBOX-780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jukka Zitting resolved PDFBOX-780.
----------------------------------
Resolution: Fixed
Thanks Craig! I fixed this in revision 988495 by setting _awtFont to Font.decode(null) instead of just null.
The Font.decode(null) call is defined to return a default Font with "the family name 'Dialog', a size of 12 and a PLAIN style".
> EXCEPTION_ACCESS_VIOLATION in fontmanager.so/fontmanager.dll
> ------------------------------------------------------------
>
> Key: PDFBOX-780
> URL: https://issues.apache.org/jira/browse/PDFBOX-780
> Project: PDFBox
> Issue Type: Bug
> Environment: redhat linux rhel5 and windows xp
> Reporter: Matt Davis
> Assignee: Jukka Zitting
> Fix For: 1.3.0
>
> Attachments: test.pdf
>
>
> It seems when writing a PDF that has an invalid embedded font to an image there is a crash in the native function sun.font.FileFont.getGlyphImage(JI). It can be reproduced using the PDFToImage program on a pdf with an invalid embedded font.
> Turing on -Dsun.java2d.debugfonts=true on a bad pdf will show some like the follow for the bad font
> INFO: open TTF: C:\DOCUME~1\mdavis\LOCALS~1\Temp\+~JF4968602841241472406.tmp
> Jul 20, 2010 11:37:31 AM sun.font.TrueTypeGlyphMapper handleBadCMAP
> SEVERE: Null Cmap for ** TrueType Font: Family=INKLBC+SymbolMT Name=INKLBC+SymbolMT style=0 fileName=C:\DOCUME~1\mdavis\LOCALS~1\Temp\+~JF4968602841241472406.tmpsubstituting for this font
> Jul 20, 2010 11:37:31 AM sun.font.FontManager deRegisterBadFont
> SEVERE: Deregister bad font: ** TrueType Font: Family=INKLBC+SymbolMT Name=INKLBC+SymbolMT style=0 fileName=C:\DOCUME~1\mdavis\LOCALS~1\Temp\+~JF4968602841241472406.tmp
> Jul 20, 2010 11:37:31 AM sun.font.FileFontStrike <init>
> INFO: Strike for ** TrueType Font: Family=INKLBC+SymbolMT Name=INKLBC+SymbolMT style=0 fileName=C:\DOCUME~1\mdavis\LOCALS~1\Temp\+~JF4968602841241472406.tmp at size = 19 use natives = false useJavaRasteriser = true AAHint = 2 Has Embedded bitmaps = false
> The following code in PDSimpleFont.java seems to fix the crash although I am not sure if it is correct:
> public void drawString(String string, Graphics g, float fontSize, AffineTransform at, float x, float y) throws IOException {
> Font _awtFont = getawtFont();
>
>
> //mdavis - fix fontmanager.so/dll on sun.font.FileFont.getGlyphImage for font with bad cmaps?
> if (_awtFont.canDisplayUpTo(string) != -1) {
> log.warn("Changing fonts on <" + string + "> from <" + _awtFont.getName() + "> to default font");
> _awtFont = null;
> }
>
> Graphics2D g2d = (Graphics2D) g;
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (PDFBOX-780) EXCEPTION_ACCESS_VIOLATION in
fontmanager.so/fontmanager.dll
Posted by "Matt Davis (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PDFBOX-780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Matt Davis updated PDFBOX-780:
------------------------------
Attachment: test.pdf
Page 3 of this file crashes PDFToImage
> EXCEPTION_ACCESS_VIOLATION in fontmanager.so/fontmanager.dll
> ------------------------------------------------------------
>
> Key: PDFBOX-780
> URL: https://issues.apache.org/jira/browse/PDFBOX-780
> Project: PDFBox
> Issue Type: Bug
> Environment: redhat linux rhel5 and windows xp
> Reporter: Matt Davis
> Attachments: test.pdf
>
>
> It seems when writing a PDF that has an invalid embedded font to an image there is a crash in the native function sun.font.FileFont.getGlyphImage(JI). It can be reproduced using the PDFToImage program on a pdf with an invalid embedded font.
> Turing on -Dsun.java2d.debugfonts=true on a bad pdf will show some like the follow for the bad font
> INFO: open TTF: C:\DOCUME~1\mdavis\LOCALS~1\Temp\+~JF4968602841241472406.tmp
> Jul 20, 2010 11:37:31 AM sun.font.TrueTypeGlyphMapper handleBadCMAP
> SEVERE: Null Cmap for ** TrueType Font: Family=INKLBC+SymbolMT Name=INKLBC+SymbolMT style=0 fileName=C:\DOCUME~1\mdavis\LOCALS~1\Temp\+~JF4968602841241472406.tmpsubstituting for this font
> Jul 20, 2010 11:37:31 AM sun.font.FontManager deRegisterBadFont
> SEVERE: Deregister bad font: ** TrueType Font: Family=INKLBC+SymbolMT Name=INKLBC+SymbolMT style=0 fileName=C:\DOCUME~1\mdavis\LOCALS~1\Temp\+~JF4968602841241472406.tmp
> Jul 20, 2010 11:37:31 AM sun.font.FileFontStrike <init>
> INFO: Strike for ** TrueType Font: Family=INKLBC+SymbolMT Name=INKLBC+SymbolMT style=0 fileName=C:\DOCUME~1\mdavis\LOCALS~1\Temp\+~JF4968602841241472406.tmp at size = 19 use natives = false useJavaRasteriser = true AAHint = 2 Has Embedded bitmaps = false
> The following code in PDSimpleFont.java seems to fix the crash although I am not sure if it is correct:
> public void drawString(String string, Graphics g, float fontSize, AffineTransform at, float x, float y) throws IOException {
> Font _awtFont = getawtFont();
>
>
> //mdavis - fix fontmanager.so/dll on sun.font.FileFont.getGlyphImage for font with bad cmaps?
> if (_awtFont.canDisplayUpTo(string) != -1) {
> log.warn("Changing fonts on <" + string + "> from <" + _awtFont.getName() + "> to default font");
> _awtFont = null;
> }
>
> Graphics2D g2d = (Graphics2D) g;
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Reopened: (PDFBOX-780) EXCEPTION_ACCESS_VIOLATION in
fontmanager.so/fontmanager.dll
Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PDFBOX-780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jukka Zitting reopened PDFBOX-780:
----------------------------------
Reopened to address the problem reported by Craig
> EXCEPTION_ACCESS_VIOLATION in fontmanager.so/fontmanager.dll
> ------------------------------------------------------------
>
> Key: PDFBOX-780
> URL: https://issues.apache.org/jira/browse/PDFBOX-780
> Project: PDFBox
> Issue Type: Bug
> Environment: redhat linux rhel5 and windows xp
> Reporter: Matt Davis
> Assignee: Jukka Zitting
> Fix For: 1.3.0
>
> Attachments: test.pdf
>
>
> It seems when writing a PDF that has an invalid embedded font to an image there is a crash in the native function sun.font.FileFont.getGlyphImage(JI). It can be reproduced using the PDFToImage program on a pdf with an invalid embedded font.
> Turing on -Dsun.java2d.debugfonts=true on a bad pdf will show some like the follow for the bad font
> INFO: open TTF: C:\DOCUME~1\mdavis\LOCALS~1\Temp\+~JF4968602841241472406.tmp
> Jul 20, 2010 11:37:31 AM sun.font.TrueTypeGlyphMapper handleBadCMAP
> SEVERE: Null Cmap for ** TrueType Font: Family=INKLBC+SymbolMT Name=INKLBC+SymbolMT style=0 fileName=C:\DOCUME~1\mdavis\LOCALS~1\Temp\+~JF4968602841241472406.tmpsubstituting for this font
> Jul 20, 2010 11:37:31 AM sun.font.FontManager deRegisterBadFont
> SEVERE: Deregister bad font: ** TrueType Font: Family=INKLBC+SymbolMT Name=INKLBC+SymbolMT style=0 fileName=C:\DOCUME~1\mdavis\LOCALS~1\Temp\+~JF4968602841241472406.tmp
> Jul 20, 2010 11:37:31 AM sun.font.FileFontStrike <init>
> INFO: Strike for ** TrueType Font: Family=INKLBC+SymbolMT Name=INKLBC+SymbolMT style=0 fileName=C:\DOCUME~1\mdavis\LOCALS~1\Temp\+~JF4968602841241472406.tmp at size = 19 use natives = false useJavaRasteriser = true AAHint = 2 Has Embedded bitmaps = false
> The following code in PDSimpleFont.java seems to fix the crash although I am not sure if it is correct:
> public void drawString(String string, Graphics g, float fontSize, AffineTransform at, float x, float y) throws IOException {
> Font _awtFont = getawtFont();
>
>
> //mdavis - fix fontmanager.so/dll on sun.font.FileFont.getGlyphImage for font with bad cmaps?
> if (_awtFont.canDisplayUpTo(string) != -1) {
> log.warn("Changing fonts on <" + string + "> from <" + _awtFont.getName() + "> to default font");
> _awtFont = null;
> }
>
> Graphics2D g2d = (Graphics2D) g;
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.