forked from khaledhosny/ots
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upload test scripts for ots which I'm currently using.
- test_unmalicious_fonts.sh Apply ots/test/idempotent to all TT/OT files under $BASEDIR in order to verify that: * OTS does not reject unmalicious fonts. * The new font OTS generates can be loaded by a system font renderer. - test_malicious_fonts.sh Apply ots/test/validator-checker to all malicious TT/OT files in order to verify that OTS can reject malicious fonts, or the "sanitized" font generated by OTS does not crash a system font renderer. - test/validator-checker.cc Add Mac support. - test/idempotent.cc Add Mac and FreeType2 support. Example output: yusukes@z-yusukes-jp:~/chromium/src/third_party/ots/test$ ./test_unmalicious_fonts.sh ................ FAIL: /usr/share/fonts/truetype/ttf-oriya-fonts/Samyak-Oriya.ttf (Run ./idempotent /usr/share/fonts/truetype/ttf-oriya-fonts/Samyak-Oriya.ttf for more information.) ........ yusukes@z-yusukes-jp:~/chromium/src/third_party/ots/test$ Review URL: http://codereview.chromium.org/408020 BUG=27139 TEST=see http://code.google.com/p/ots/wiki/HowToTestOts TBR=jshin
- Loading branch information
1 parent
67ad2a2
commit e3a3626
Showing
6 changed files
with
361 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
# Required table(s) are missing (e.g. OS/2 table). | ||
AppleGothic.ttf | ||
AppleMyungjo.ttf | ||
ArialHB.ttf | ||
ArialHBBold.ttf | ||
Corsiva.ttf | ||
CorsivaBold.ttf | ||
InaiMathi.ttf | ||
NISC18030.ttf | ||
NewPeninimMT.ttf | ||
NewPeninimMTBold.ttf | ||
NewPeninimMTBoldInclined.ttf | ||
NewPeninimMTInclined.ttf | ||
Raanana.ttf | ||
RaananaBold.ttf | ||
|
||
# The length field of a table is weird. | ||
homa.ttf | ||
nazli.ttf | ||
titr.ttf | ||
ume-tgc4.ttf | ||
ume-tgs4.ttf | ||
ume-tgc5.ttf | ||
ume-tgs5.ttf | ||
ume-tms3.ttf | ||
|
||
# Table(s) are not 4-byte aligned. | ||
UnBatang.ttf | ||
UnBom.ttf | ||
UnDotum.ttf | ||
UnGraphic.ttf | ||
UnGungseo.ttf | ||
UnJamoBatang.ttf | ||
UnJamoDotum.ttf | ||
UnJamoNovel.ttf | ||
UnJamoSora.ttf | ||
UnPenheulim.ttf | ||
UnPen.ttf | ||
UnPilgiBold.ttf | ||
UnPilgi.ttf | ||
UnShinmun.ttf | ||
UnTaza.ttf | ||
UnYetgul.ttf | ||
|
||
# Tables are not sorted by table tags. | ||
f500.ttf | ||
|
||
# non-ASCII characters are used in a table tag | ||
SyrCOMAdiabene.otf | ||
SyrCOMAntioch.otf | ||
SyrCOMBatnanBold.otf | ||
SyrCOMBatnan.otf | ||
SyrCOMCtesiphon.otf | ||
SyrCOMJerusalemBold.otf | ||
SyrCOMJerusalemItalic.otf | ||
SyrCOMJerusalem.otf | ||
SyrCOMJerusalemOutline.otf | ||
SyrCOMKharput.otf | ||
SyrCOMMalankara.otf | ||
SyrCOMMardinBold.otf | ||
SyrCOMMardin.otf | ||
SyrCOMMidyat.otf | ||
SyrCOMNisibin.otf | ||
SyrCOMNisibinOutline.otf | ||
SyrCOMQenNeshrin.otf | ||
SyrCOMTalada.otf | ||
SyrCOMTurAbdin.otf | ||
SyrCOMUrhoyBold.otf | ||
SyrCOMUrhoy.otf | ||
|
||
# Malformed SFNT table; unexpected entry selector | ||
misakimn.ttf | ||
misaki.ttf | ||
|
||
# Malformed CMAP table; Subtables are not sorted by platform ID | ||
ani.ttf | ||
Caliban.ttf | ||
|
||
# Malformed CMAP table; Entries in a 3-0-4 or 3-1-4 subtable are not sorted. | ||
LucidaSansOblique.ttf | ||
LucidaTypewriterOblique.ttf | ||
bkai00mp.ttf | ||
bsmi00lp.ttf | ||
modelwor.ttf | ||
|
||
# Malformed CMAP table; "search range" in a 3-0-4 or 3-1-4 subtable are invalid. | ||
cmmi10.ttf | ||
cmsy10.ttf | ||
msam10.ttf | ||
|
||
# Malformed CMAP table; The 3-10-12 table is too short. | ||
BPG_Chveulebrivi.ttf | ||
BPG_Chveulebrivi_bold.ttf | ||
|
||
# Unsupported CMAP table; ots doesn't support non-Unicode fonts. | ||
Apple Symbols.ttf | ||
儷宋 Pro.ttf | ||
儷黑 Pro.ttf | ||
华文仿宋.ttf | ||
华文宋体.ttf | ||
华文楷体.ttf | ||
华文细黑.ttf | ||
华文黑体.ttf | ||
|
||
# Unsupported CMAP table; The Unicode BMP table is missing, while the UCS-4 table is available. | ||
DroidSansJapanese.ttf | ||
DroidSansFallback.ttf | ||
|
||
# Malformed GLYF table; The content of flags array and the lengths of xCoordinates, yCoordinates are inconsistent. | ||
DecoTypeNaskh.ttf | ||
|
||
# Malformed POST table; A glyph index in the reserved area (>= 32768) is specified. | ||
wqy-zenhei.ttf | ||
unifont.ttf | ||
|
||
# Malformed HMTX table; The table is too short. | ||
mona.ttf | ||
|
||
# CMAP glyph id is out of range. | ||
Samyak-Oriya.ttf | ||
|
||
# Unsupported CFF table; "supplemental encoding" is not supported at the moment. This should be fixed in the future. | ||
Walbf___.otf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (c) 2009 The Chromium Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
# Usage: ./test_malicious_fonts.sh [ttf_or_otf_file_name] | ||
|
||
BASE_DIR=~/malicious/ | ||
CHECKER=./validator-checker | ||
|
||
if [ ! -x "$CHECKER" ] ; then | ||
echo "$CHECKER is not found." | ||
exit 1 | ||
fi | ||
|
||
if [ $# -eq 0 ] ; then | ||
# No font file is specified. Apply this script to all TT/OT files under the | ||
# BASE_DIR. | ||
if [ ! -d $BASE_DIR ] ; then | ||
echo "$BASE_DIR does not exist." | ||
exit 1 | ||
fi | ||
|
||
# Recursively call this script. | ||
find $BASE_DIR -type f -name '*tf' -exec "$0" {} \; | ||
echo | ||
exit 0 | ||
fi | ||
|
||
if [ $# -gt 1 ] ; then | ||
echo "Usage: $0 [ttf_or_otf_file_name]" | ||
exit 1 | ||
fi | ||
|
||
# Confirm that the malicious font file does not crash OTS nor OS font renderer. | ||
base=`basename "$1"` | ||
"$CHECKER" "$1" > /dev/null 2>&1 || (echo ; echo "\nFAIL: $1 (Run $CHECKER $1 for more information.)") | ||
echo -n "." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (c) 2009 The Chromium Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
# Usage: ./test_unmalicious_fonts.sh [ttf_or_otf_file_name] | ||
|
||
BLACKLIST=./BLACKLIST.txt | ||
CHECKER=./idempotent | ||
|
||
if [ ! -r "$BLACKLIST" ] ; then | ||
echo "$BLACKLIST is not found." | ||
exit 1 | ||
fi | ||
|
||
if [ ! -x "$CHECKER" ] ; then | ||
echo "$CHECKER is not found." | ||
exit 1 | ||
fi | ||
|
||
if [ $# -eq 0 ] ; then | ||
# No font file is specified. Apply this script to all TT/OT files under the | ||
# BASE_DIR below. | ||
|
||
# On Ubuntu Linux (>= 8.04), You can install ~1800 TrueType/OpenType fonts | ||
# to /usr/share/fonts/truetype by: | ||
# % sudo apt-get install ttf-.*[^0]$ | ||
BASE_DIR=/usr/share/fonts/truetype/ | ||
if [ ! -d $BASE_DIR ] ; then | ||
# Mac OS X | ||
BASE_DIR="/Library/Fonts/ /System/Library/Fonts/" | ||
fi | ||
# TODO(yusukes): Support Cygwin. | ||
|
||
# Recursively call this script. | ||
find $BASE_DIR -type f -name '*tf' -exec "$0" {} \; | ||
echo | ||
exit 0 | ||
fi | ||
|
||
if [ $# -gt 1 ] ; then | ||
echo "Usage: $0 [ttf_or_otf_file_name]" | ||
exit 1 | ||
fi | ||
|
||
# Check the font file using idempotent iff the font is not blacklisted. | ||
base=`basename "$1"` | ||
egrep -i -e "^$base" "$BLACKLIST" > /dev/null 2>&1 || "$CHECKER" "$1" > /dev/null 2>&1 || (echo ; echo "FAIL: $1 (Run $CHECKER $1 for more information.)") | ||
echo -n "." |
Oops, something went wrong.