Summary: | double free in file_close_disable | ||
---|---|---|---|
Product: | Ghostscript | Reporter: | Ralph Giles <ralph.giles> |
Component: | General | Assignee: | Alex Cherepanov <alex> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 8.62 | ||
Hardware: | PC | ||
OS: | Linux | ||
Customer: | Word Size: | --- |
Description
Ralph Giles
2008-07-17 12:02:49 UTC
Created attachment 4229 [details]
X0510_01.pdf
I've reproduced with trunk and the following minimal command line: $ debugobj/gs -dSAFER - < X0510_01.pdf The file uses Japanese fonts, and so the following must be added to lib/cidfmap: /Kochi-Gothic << /FileType /TrueType /Path (/usr/share/fonts/truetype/kochi/kochi-gothic-subst.ttf) /CSI [(Japan1) 6] >> ; /Kochi-Gothic-Regular /Kochi-Gothic ; /Kochi-Gothic-JaH << /FileType /TrueType /Path (/usr/share/fonts/truetype/kochi/kochi-gothic-subst.ttf) /CSI [(Japan2) 0] >> ; /Kochi-Gothic-Regular-JaH /Kochi-Gothic-JaH ; /Kochi-Mincho << /FileType /TrueType /Path (/usr/share/fonts/truetype/kochi/kochi-mincho-subst.ttf) /CSI [(Japan1) 6] >> ; /Kochi-Mincho-Regular /Kochi-Mincho ; /Kochi-Mincho-JaH << /FileType /TrueType /Path (/usr/share/fonts/truetype/kochi/kochi-mincho-subst.ttf) /CSI [(Japan2) 0] >> ; /Kochi-Mincho-Regular-JaH /Kochi-Mincho-JaH ; /Ryumin-Light /Kochi-Mincho ; /GothicBBB-Medium /Kochi-Gothic ; /Adobe-Japan1 /Kochi-Gothic ; /Adobe-Japan2 /Kochi-Gothic-JaH ; These paths are specific to Ubuntu Linux. The user had different ones from the gentoo build. Both -dSAFER and feeding the file from stdin are necessary to reproduce the double free. The /invalidfileaccess is because the fonts referenced from cidfmap are not on the permitted read list. If they're added (for example with -I/usr/share/fonts/truetype/kochi in the example above) the double free is not reported. In this case the document still doesn't render past the first page, complaining: Loading a TT font from /usr/share/fonts/truetype/kochi/kochi-gothic-subst.ttf to emulate a CID font Kochi-Gothic ... Done. Error: /invalidfont in --.buildcidfont-- So there may be other issues with this file, or with the cidfmap used. The file appears to have some kind of javascript DRM, and displays as blank in evince and Apple Preview. Adobe Reader asks if the document can access itself through a url and when blocked also shows the document as blank. However the content is visible briefly when scrolling. Double free can cause stability problems. We have many customers using Asian CID fonts, but I don't know if they are having 'PermitFileReading' problems (most don't bother with -dSAFER). Use a proper destructor to free a file stream when access to the file is not permitted in the safe mode, not just close the file and drop the rest of the file structure. The following patch is committed as a rev. 9307. http://ghostscript.com/pipermail/gs-cvs/2008-December/008885.html Our standard regression testing doesn't cover the safe mode. Testing under Valgrind shows that double fclose() (and double free()) no longer occurs. |