summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@hotmail.com>2009-07-18 14:43:25 +0200
committerSebastian Rasmussen <sebras@hotmail.com>2009-07-18 14:43:25 +0200
commit113c25bf75e12d37ead6564869505c177b0b4c6f (patch)
tree5a3cc011e24b8ad2476c8c078480ab46838a1d9b /apps
parentcdf3b29e5fac3ec1e151206a6a11747308d7e9b6 (diff)
downloadmupdf-113c25bf75e12d37ead6564869505c177b0b4c6f.tar.xz
Do not let pdfinfo fail on invalid objects/dicts.
Diffstat (limited to 'apps')
-rw-r--r--apps/pdfinfo.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/apps/pdfinfo.c b/apps/pdfinfo.c
index af44d1fa..e4340ac8 100644
--- a/apps/pdfinfo.c
+++ b/apps/pdfinfo.c
@@ -262,11 +262,14 @@ gatherfonts(int page, fz_obj *pageobj, fz_obj *dict)
fontdict = ref = fz_dictgetval(dict, i);
if (!fz_isdict(fontdict))
- return fz_throw("not a font dict (%d %d R)", fz_tonum(ref), fz_togen(ref));
+ {
+ fz_warn("not a font dict (%d %d R)", fz_tonum(ref), fz_togen(ref));
+ continue;
+ }
subtype = fz_dictgets(fontdict, "Subtype");
if (!fz_isname(subtype))
- return fz_throw("not a font dict subtype (%d %d R)", fz_tonum(ref), fz_togen(ref));
+ fz_warn("not a font dict subtype (%d %d R)", fz_tonum(ref), fz_togen(ref));
basefont = fz_dictgets(fontdict, "BaseFont");
if (basefont)
@@ -556,11 +559,14 @@ gathershadings(int page, fz_obj *pageobj, fz_obj *dict)
type = fz_dictgets(shade, "ShadingType");
if (!fz_isint(type) || fz_toint(type) < 1 || fz_toint(type) > 7)
- return fz_throw("not a shading type (%d %d R)", fz_tonum(ref), fz_togen(ref));
+ {
+ fz_warn("not a shading type (%d %d R)", fz_tonum(ref), fz_togen(ref));
+ type = nil;
+ }
for (k = 0; k < shadings; k++)
if (fz_tonum(shading[k]->ref) == fz_tonum(ref) &&
- fz_togen(shading[k]->ref) == fz_togen(ref))
+ fz_togen(shading[k]->ref) == fz_togen(ref))
break;
if (k < shadings)
@@ -605,22 +611,31 @@ gatherpatterns(int page, fz_obj *pageobj, fz_obj *dict)
type = fz_dictgets(patterndict, "PatternType");
if (!fz_isint(type) || fz_toint(type) < 1 || fz_toint(type) > 2)
- return fz_throw("not a pattern type (%d %d R)", fz_tonum(ref), fz_togen(ref));
+ {
+ fz_warn("not a pattern type (%d %d R)", fz_tonum(ref), fz_togen(ref));
+ type = nil;
+ }
if (fz_toint(type) == 1)
{
paint = fz_dictgets(patterndict, "PaintType");
if (!fz_isint(paint) || fz_toint(paint) < 1 || fz_toint(paint) > 2)
- return fz_throw("not a pattern paint type (%d %d R)", fz_tonum(ref), fz_togen(ref));
+ {
+ fz_warn("not a pattern paint type (%d %d R)", fz_tonum(ref), fz_togen(ref));
+ paint = nil;
+ }
tiling = fz_dictgets(patterndict, "TilingType");
if (!fz_isint(tiling) || fz_toint(tiling) < 1 || fz_toint(tiling) > 3)
- return fz_throw("not a pattern tiling type (%d %d R)", fz_tonum(ref), fz_togen(ref));
+ {
+ fz_warn("not a pattern tiling type (%d %d R)", fz_tonum(ref), fz_togen(ref));
+ tiling = nil;
+ }
}
for (k = 0; k < patterns; k++)
if (fz_tonum(pattern[k]->ref) == fz_tonum(ref) &&
- fz_togen(pattern[k]->ref) == fz_togen(ref))
+ fz_togen(pattern[k]->ref) == fz_togen(ref))
break;
if (k < patterns)