src/cff


Log

Author Commit Date CI Message
Werner Lemberg 14032290 2018-07-20T06:44:13 [cff] Avoid left-shift of negative numbers (#54322). * src/cff/cffgload.c (cff_slot_load): Use multiplication.
Werner Lemberg 6ceeb87f 2018-07-05T22:31:10 Fix more 32bit issues (#54208) * src/cff/cffload.c (cff_blend_build_vector): Convert assertion into run-time error. * src/truetype/ttgxvar.c (ft_var_to_normalized): Protect against numeric overflow.
Werner Lemberg cc333390 2018-06-24T06:22:48 New base function `FT_Matrix_Check' (#54019). * src/base/ftcalc.c (FT_Matrix_Check): New base function to properly reject degenerate font matrices. * include/freetype/internal/ftcalc.h: Updated. * src/cff/cffparse.c (cff_parse_font_matrix), src/cid/cidload.c (cid_parse_font_matrix), src/type1/t1load.c (t1_parse_font_matrix), src/type42/t42parse.c (t42_parse_font_matrix): Use `FT_Matrix_Check'.
Werner Lemberg 9ac9060d 2018-06-03T09:01:17 [GSoC] src/*.*: Convert block comments to `light' style. This monster commit was created by applying Nikhil's scripts `docconverter.py' and `markify.py' to all C header and source files, followed up by minor manual clean-up. No change in functionality, of course. I used commit f7419907bc6044b9b7057f9789866426c804ba82 from https://github.com/nikramakrishnan/freetype-docs.git.
Werner Lemberg 95149592 2018-05-02T20:27:48 Remove FT_CONFIG_OPTION_PIC and related code. */* [FT_CONFIG_OPTION_PIC]: Remove all code guarded by this preprocessor symbol. */*: Replace `XXX_GET' macros (which could be either a function in PIC mode or an array in non-PIC mode) with `xxx' arrays. * include/freetype/internal/ftpic.h, src/autofit/afpic.c, src/autofit/afpic.h, src/base/basepic.c, src/base/basepic.h, src/base/ftpic.c, src/cff/cffpic.c, src/cff/cffpic.h, src/pshinter/pshpic.c, src/pshinter/pshpic.h, src/psnames/pspic.c, src/psnames/pspic.h, src/raster/rastpic.c, src/raster/rastpic.h, src/sfnt/sfntpic.c, src/sfnt/sfntpic.h, src/smooth/ftspic.c, src/smooth/ftspic.h, src/truetype/ttpic.c, src/truetype/ttpic.h: Removed.
Werner Lemberg 3b8f1680 2018-04-04T20:26:08 [cff, type1] Sanitize `BlueFuzz' and `BlueShift'. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7371 * src/cff/cffload.c (cff_load_private_dict): Sanitize `priv->blue_shift' and `priv->blue_fuzz' to avoid overflows later on. * src/type1/t1load.c (T1_Open_Face): Ditto.
Werner Lemberg 0a0c2256 2018-01-02T09:33:57 Update copyright year.
Werner Lemberg dd6330d7 2017-12-27T08:06:47 Add missing ChangeLog entry, copyright notices, whitespace, formatting.
Ewald Hew a956e36c 2017-12-25T12:34:37 Move PostScript drivers' property handlers to `base' This reduces the amount of duplicated code across PostScript drivers. * src/cff/cffdrivr.c, src/cid/cidriver.c, src/type1/t1driver.c ({cff,cid,t1}_property_{get,set}): Moved to... * include/freetype/internal/ftpsprop.h: ...this new file. (ps_property_{get,set}): New functions to replace moved ones. * src/base/ftpsprop.c: Implement above functions. * include/freetype/internal/internal.h (FT_INTERNAL_POSTSCRIPT_PROPS_H): New macro. * src/cff/cffdrivr.c, src/cid/cidriver.c, src/type1/t1driver.c: Updated. * src/base/Jamfile, src/base/rules.mk, src/base/ftbase.c: Updated.
Werner Lemberg 068a7a03 2017-12-18T20:34:05 * src/*/*: Only use `ft_' and `FT_' variants of stdc library stuff.
Werner Lemberg 98ba0c4a 2017-12-08T18:38:41 New `ftdriver.h' file, covering all driver modules. This reduces redundancy and increases synergy; it also reduces the number of header files. * include/freetype/config/ftheader.h (FT_DRIVER_H): New macro. (FT_AUTOHINTER_H, FT_CFF_DRIVER_H, FT_TRUETYPE_DRIVER_H, FT_PCF_DRIVER_H, FT_TYPE1_DRIVER_H): Make them aliases to FT_DRIVER_H. * include/freetype/ftautoh.h, include/freetype/ftcffdrv.h, include/freetype/ftpcfdrv.h, include/freetype/ftt1drv.h, include/freetype/ftttdrv.h: Replaced with... * include/freetype/ftdriver.h: ...this new file. (FT_CFF_HINTING_ADOBE, FT_T1_HINTING_ADOBE): Renamed to... (FT_HINTING_ADOBE): ... this new macro. (FT_CFF_HINTING_FREETYPE, FT_T1_HINTING_FREETYPE): Renamed to... (FT_HINTING_FREETYPE): ... this new macro. * src/*/*: Updated accordingly.
Werner Lemberg 63b91548 2017-12-07T14:33:44 Fix `make multi'. * include/freetype/internal/fttrace.h: Remove unused tracing macros. s/pshalgo2/pshalgo/. Add `trace_cffdecode'. * src/pshinter/pshalgo.c (FT_COMPONENT): Updated. * src/cff/cffload.c: Include FT_INTERNAL_POSTSCRIPT_AUX_H. * src/cff/cffobjs.c: Include FT_SERVICE_METRICS_VARIATIONS_H and FT_SERVICE_CFF_TABLE_LOAD_H. * src/cid/cidriver.c: Include FT_INTERNAL_POSTSCRIPT_AUX_H. * src/psaux/cffdecode.c: Include FT_FREETYPE_H and FT_INTERNAL_DEBUG_H. (FT_COMPONENT): Define. * src/psaux/cffdecode.h: Include FT_INTERNAL_POSTSCRIPT_AUX_H. * src/psaux/psauxmod.h: Include FT_INTERNAL_POSTSCRIPT_AUX_H. Declare `cff_builder_funcs' and `ps_builder_funcs'. * src/psaux/psft.c: Include `psobjs.h' and `cffdecode.h'. * src/psaux/psobjs.c : Include `psauxmod.h'.
Werner Lemberg 71fecc53 2017-12-05T12:06:29 Improve tracing messages by using singular and plural forms. * src/*/*.c: Implement it.
Ewald Hew 94f6d57a 2017-10-16T11:48:31 [cff] Fix segfault on missing `psaux' (#52218) * src/cff/cffload.c (cff_done_blend): Add a check for possible nullptr. * modules.cfg: Update dependency list.
Alexei Podtelezhnikov ccb0f799 2017-10-15T14:19:13 [base, cff] Fix MSVC warnings. * src/base/ftobjs.c (FT_New_Library): C4702: unreachable code. (ft_glyphslot_preset_bitmap): C4244: possible loss of data. * src/cff/cffload.c (cff_blend_doBlend): C4244: possible loss of data. Turn `sum' into unsigned.
Werner Lemberg f89c67f0 2017-10-07T13:10:53 [cff, truetype] Adjust behaviour of named instances. This commit completely separates the interaction between named instances and variation functions. In particular, resetting the variation returns to the current named instance (if set) and not to the base font. As a side effect, variation functions no longer change the named instance index. * src/cff/cffobjs.c (cff_face_init): Use MM service's `set_instance' function. Also apply `MVAR' table to named instances. * src/truetype/ttgxvar.c (TT_Get_MM_Var): Add cast. (tt_set_mm_blend): No longer check whether requested variation coincides with a named instance. (TT_Set_Var_Design): Use current named instance for default coordinates. * src/truetype/ttobjs.c (tt_face_init): Use `TT_Set_Named_Instance'.
Werner Lemberg e9ef538a 2017-10-07T12:57:11 Make `FT_Set_Named_Instance' work. * src/cff/cffdrivr.c (cff_set_instance): New function. (cff_service_multi_masters): Register it. * src/truetype/ttgxvar.c (TT_Set_Named_Instance): New function. * src/truetype/ttgxvar.h: Updated. * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Register it. * src/type1/t1load.c (T1_Reset_MM_Blend): New function. * src/type1/t1load.h: Updated. * src/type1/t1driver.c (t1_service_multi_masters): Register it.
Werner Lemberg 8c92f762 2017-10-07T12:12:49 Make `FT_FACE_FLAG_VARIATION' work. * include/freetype/internal/tttypes.h (TT_Face): Remove `is_default_instance'; this can be replaced with a combination of `FT_IS_VARIATION' and `FT_IS_INSTANCE'. * src/cff/cffdrivr.c (cff_get_advances): Updated. * src/sfnt/sfdriver.c (sfnt_get_ps_name), src/sfnt/sfobjs.c (sfnt_init_face): Updated. * src/truetype/ttdriver.c (tt_get_advances), src/truetype/ttgload.c (TT_Process_Simple_Glyph, load_truetype_glyph, IS_DEFAULT_INSTANCE), src/truetype/ttgxvar.c (tt_set_mm_blend): Updated. * src/truetype/ttgxvar.c (TT_Set_MM_Blend, TT_Set_Var_Design): Handle `FT_FACE_FLAG_VARIATION'. * src/type1/t1load.c (T1_Set_MM_Blend, T1_Set_MM_Design): Handle `FT_FACE_FLAG_VARIATION'.
Werner Lemberg e23fe2ad 2017-10-07T11:25:04 Add framework for setting named instance in MM service. * include/freetype/internal/services/svmm.h (FT_Set_Instance_Func): New function typedef. (MultiMasters): Add `set_instance' member. (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. * src/cff/cffdrivr.c (cff_service_multi_masters), src/truetype/ttdriver (tt_service_gx_multi_masters), src/type1/t1driver.c (t1_service_multi_masters): Updated.
Werner Lemberg 2e58808d 2017-10-05T14:26:33 Fix compiler warnings. * src/cff/cffdrivr.c (cff_ps_get_font_extra): Avoid code that relies on numeric overflow. Add cast. * src/smooth/ftsmooth.c (ft_smooth_render_generic): Fix variable types, add cast.
John Tytgat 1df35d94 2017-10-04T22:46:36 [cff] Add support for `FSType'. * include/freetype/internal/cfftypes.h (CFF_FontRec): Add `font_extra' entry. * src/cff/cffdrivr.c (cff_ps_get_font_extra): New function to retrieve FSType info from the embedded PostScript data. (cff_service_ps_info): Register function. * src/cff/cffload.c (cff_font_done): Free `font_extra'.
Werner Lemberg 9b549fa6 2017-09-30T16:36:28 [base,cff,cid] Whitespace, formatting.
Ewald Hew ebb1735a 2017-09-25T08:26:57 Move `psdecode' into `psobjs'. As the former only contains a single procedure, move it into `psobjs' for simplicity. Also change the parameter order to the conventional one. * src/psaux/psdecode.c (ps_decoder_init): Moved to... * src/psaux/psobjs.c: ...Here. * src/psaux/psdecode.h, src/psaux/psobjs.h: Ditto. * include/freetype/internal/psaux.h (PSAux_ServiceRec): Update `ps_decoder_init' function signature. * src/cff/cffgload.c, src/cid/cidgload.c, src/type1/t1gload.c: Update calls. * src/psaux/psaux.c, src/psaux/psauxmod.c: Update includes. * src/psaux/Jamfile (_sources), src/psaux/rules.mk (PSAUX_DRV_SRC): Update file references.
Ewald Hew 645d1b86 2017-09-25T06:28:25 Move and rename `CFF_Driver'. This is so that we can use the same hinting engine parameters for Type 1. * include/freetype/internal/cffotypes.h (CFF_Driver): Rename and move to... * include/freetype/internal/psaux.h (PS_Driver): ...here. * src/cff/cffdrivr.c, src/cff/cffgload.c, src/cff/cffload.c, src/cff/cffobjs.c, src/cff/cffobjs.h, src/psaux/psft.c, src/psaux/psobjs.c: Update references.
Ewald Hew 0589e3c0 2017-09-25T06:10:20 Use the new objects. * include/freetype/internal/psaux.h, src/psaux/psauxmod.c: Fix switching between new and old engines. * src/cff/cffgload.c, src/cff/cffparse.c: Update calls. * src/psaux/psblues.c, src/psaux/psfont.c, src/psaux/psfont.h, src/psaux/psft.c, src/psaux/psft.h, src/psaux/psintrp.c: Update all to use new objects.
Ewald Hew b624868b 2017-09-24T22:32:40 Move `cff_random' into `psaux' service. NOTE: Does not compile! Minor fix to allow both `cff' and `psaux' to use `cff_random'. * src/cff/cffload.c (cff_random): Move to... * src/psaux/psobjs.c: Here. * src/cff/cffload.h: Move corresponding declaration to `src/psaux/psobjs.h'. * include/freetype/internal/psaux.h (PSAux_ServiceRec): Register the function here... * src/psaux/psauxmod.c: And here. * src/cff/cffload.c, src/psaux/cf2intrp.c: Update code.
Ewald Hew df11628b 2017-09-24T22:28:07 Move struct declarations to `freetype/internal'. NOTE: Does not compile! This is so that the CFF functions moved to `psaux' can access the same structs that they need. * src/cff/cfftypes.h: Moved to... * include/freetype/internal/cfftypes.h: ...Here. * src/cff/cffobjs.h: Moved the struct declarations to... * include/freetype/internal/cffotypes.h: ... this new file. * include/freetype/internal/internal.h (FT_INTERNAL_CFF_TYPES_H, FT_INTERNAL_CFF_OBJECT_TYPES_H): New macros. * src/cff/cffcmap.h, src/cff/cffdrivr.c, src/cff/cffgload.c, src/cff/cffgload.h, src/cff/cffload.h, src/cff/cffobjs.c, src/cff/cffobjs.h, src/cff/cffparse.h, src/psaux/psobjs.h, include/freetype/internal/psaux.h, include/freetype/internal/services/svcfftl.h: Update includes. * src/cff/rules.mk (CFF_DRV_H): Updated.
Ewald Hew edacde60 2017-09-24T22:20:38 Add new service for inter-module calls. NOTE: Does not compile! This is to allow CFF functions moved to `psaux' to call functions declared in `src/cff/cffload.h'. * include/freetype/internal/services/svcfftl.h: New file, setting up a `CFFLoad' service. * include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC10, FT_DEFINE_SERVICEDESCREC): New macros. (FT_SERVICE_CFF_TABLE_LOAD_H): New macro. * src/cff/cffdrivr.c, src/cff/cffpic.h: Register the new service. * src/cff/cfftypes.h (CFF_FontRec), src/psaux/cf2font.h (CF2_FontRec): Add service interface. * src/cff/cffobjs.c, src/psaux/cf2font.c, src/psaux/cf2ft.c, src/psaux/cf2intrp.c, src/psaux/cffdecode.c: Use the new service.
Ewald Hew 9578e07a 2017-09-24T22:05:32 Add callbacks for inter-module calls. NOTE: Does not compile! * include/freetype/internal/psaux.h: Add function pointer declarations. * src/psaux/cffdecode.c (cff_decoder_init): Update to take in callbacks. * src/psaux/cffdecode.h: Ditto. * src/cff/cffgload.c (cff_compute_max_advance, cff_slot_load): Update calls to pass in callbacks. * src/psaux/cf2ft.c, src/psaux/cffdecode.c: Use them.
Ewald Hew 1487be58 2017-09-24T21:56:54 Create new `PSAux' service interface entries. NOTE: Does not compile! * include/freetype/internal/psaux.h: Include FT_INTERNAL_TRUETYPE_TYPES_H. (CFF_Builder_FuncsRec, CFF_Decocer_FuncsRec): New function tables. (CFF_Builder): Updated. Fix for forward declaration. (PSAux_ServiceRec): New field `cff_decoder_funcs'. * src/psaux/psauxmod.c (cff_builder_funcs, cff_decoder_funcs): New function tables. (PSAux_Interface): Updated. * include/freetype/internal/tttypes.h (TT_FaceRec): Add `psaux' service interface. * src/cff/cffgload.c, src/cff/cffobjs.c, src/cff/cffparse.c: Update function calls to use psaux service.
Ewald Hew 816c9c1f 2017-09-24T21:43:05 Move CFF builder components into `psaux' module. NOTE: Does not compile! * src/cff/cffgload.c (cff_builder_{init,done,add_point,add_point1,add_contour,start_point,close_contour}, cff_check_points): Move to... * src/psaux/psobjs.c: Here. * src/cff/cffgload.h: Move corresponding declarations to `src/psaux/psobjs.h'. * src/cff/cffgload.h (CFF_Builder): Move struct declaration to... * include/freetype/internal/psaux.h: Here.
Ewald Hew 705bbe7c 2017-09-24T21:39:20 Move CFF decoder components into `psaux' module. NOTE: Does not compile! * src/cff/cffgload.c (CFF_Operator, CFF_COUNT_{CHECK_WIDTH,EXACT,CLEAR_STACK}, cff_argument_counts, cff_operator_seac, cff_compute_bias, cff_lookup_glyph_by_stdcharcode, cff_decoder_{parse_charstrings,init,prepare}): Move to... * src/psaux/cffdecode.c: This new file. * src/cff/cffgload.h: Move corresponding declarations to... * src/psaux/cffdecode.h: This new file. * src/cff/cffgload.h (CFF_MAX_{OPERANDS,SUBRS_CALLS,TRANS_ELEMENTS}, CFF_Decoder_Zone, CFF_Decoder): Move declarations to... * include/freetype/internal/psaux.h: Here. * src/psaux/cf2ft.h: Update include. * src/psaux/psaux.c, src/psaux/rules.mk (PSAUX_DRV_SRC): Update with the new file.
Ewald Hew 62f095f0 2017-09-25T09:25:55 [psaux, cff] Move Adobe's engine components into `psaux' module. This is the first patch of a sequence to move the Type 2 charstring processing capability from the `cff' module to the `psaux' module. NOTE: Does not compile! * src/cff/cf2*: Move these files to... * src/psaux/cf2*: Here. * src/cff/Jamfile (_sources), src/cff/rules.mk (CFF_DRV_SRC, CFF_DRV_H), src/cff/cff.c, src/cff/cffgload.c: Remove file references. * src/psaux/Jamfile (_sources), src/psaux/rules.mk, src/psaux/psaux.c (PSAUX_DRV_SRC, PSAUX_DRV_H): Add file references.
John Tytgat b00be9f6 2017-09-19T07:12:03 [cff] Fix family name logic of pure CFF fontdata (#52056). 1. If `FamilyName' is present in the CFF font, use this for FT_Face's `family_name'. 2. Otherwise, use the face name and chop off any subset prefix. 3. If at this point FT_Face's `family_name' is set, use this together with the full name to determine the style. 4. Otherwise, use `CIDFontName' as FT_Face's `family_name'. 5. If we don't have a valid style, use "Regular". Previously, FT_Face's `family_name' entry for pure CFF fontdata nearly always was the fontname itself, instead of the `FamilyName' entry in the CFF font (assuming there is one). * src/cff/cffobjs.c (cff_face_init) [pure_cff]: Implement it.
Werner Lemberg 933f4cbe 2017-07-26T23:32:32 [cff] Integer overflow. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2738 * src/cff/cf2hints.c (cf2_glyphpath_computeOffset, cf2_glyphpath_curveTo): Use ADD_INT32.
Werner Lemberg 9ea83c78 2017-07-07T17:09:43 [cff] Integer overflow. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2517 * src/cff/cf2blues.c (cf2_blues_capture): Use SUB_INT32.
Werner Lemberg 2e7bb5e8 2017-06-27T16:56:38 * src/cff/cffparse.c (do_fixed): Fix typo. Spotted by chris <chris@gcjd.org>.
Werner Lemberg 298e2ea5 2017-06-22T11:52:43 [cff, truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2323 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2328 * src/cff/cf2blues.c (cf2_blues_capture): Use ADD_INT32 and SUB_INT32. * src/truetype/ttinterp.c (Ins_SDPVTL): Use SUB_LONG and NEG_LONG.
Werner Lemberg 8c763fb1 2017-06-20T07:49:52 [cff, truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2300 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2313 * src/cff/cf2hints.c (cf2_hintmap_adjustHints): Use ADD_INT32. * src/truetype/ttinterp.c (Ins_ABS): Avoid FT_ABS.
Werner Lemberg dbeb7bce 2017-06-15T19:39:50 [bdf, cff] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2244 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2261 * src/bdf/bdfdrivr.c (BDF_Face_Init): Replace calls to FT_ABS with direct code to avoid value negation. * src/cff/cf2blues.c (cf2_blues_capture): Use SUB_INT32 and ADD_INT32.
Werner Lemberg 5c402d97 2017-06-13T06:56:48 [cff, truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2216 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2218 * src/cff/cf2fixed.h (cf2_fixedAbs): Use NEG_INT32. * src/truetype/ttinterp.c (Ins_IP): Use SUB_LONG.
Werner Lemberg 3ed3a961 2017-06-11T13:50:37 [cff] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2200 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2210 * src/cff/cf2hints.c (cf2_hintmap_insertHint): Use SUB_INT32 and ADD_INT32. * src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdVMOVETO>: Use ADD_INT32.
Werner Lemberg 9038837e 2017-06-09T20:42:46 [cff, truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2144 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2151 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2153 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2173 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2186 * src/cff/cf2blues.c (cf2_blues_init): Use SUB_INT32. * src/truetype/ttinterp.c (Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid, Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45): Use ADD_LONG, SUB_LONG, NEG_LONG, FT_PIX_ROUND_LONG, FT_PIX_CEIL_LONG, FT_PAD_ROUND_LONG (Ins_SxVTL, Ins_MIRP): Use SUB_LONG. (_iup_worker_shift): Use SUB_LONG and ADD_LONG.
Werner Lemberg dcd8de27 2017-06-09T11:21:58 */*: Remove `OVERFLOW_' prefix. This increases readability.
Werner Lemberg 7bffeacd 2017-06-07T17:08:01 [cff, truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2133 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2137 * src/cff/cf2hints.c (cf2_hint_init): Use OVERFLOW_SUB_INT32. * src/truetype/ttinterp.c (PROJECT, DUALPROJ): Use OVERFLOW_SUB_LONG.
Werner Lemberg 24848a3d 2017-06-06T12:05:04 [cff] Integer overflow. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2109 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2110 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2122 * src/cff/cf2blues.c (cf2_blues_init): Use OVERFLOW_SUB_INT32. * src/cff/cf2hints.c (cf2_hintmap_map): Synchronize if-else branches.
Werner Lemberg 86670429 2017-06-05T06:20:53 [cff] Integer overflow. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2089 * src/cff/cffload.c (cff_blend_doBlend): User OVERFLOW_ADD_INT32.
Werner Lemberg 9fa8a299 2017-06-04T20:43:08 [cff, truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2075 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2088 * src/cff/cf2font.c (cf2_font_setup): Use OVERFLOW_MUL_INT32. * src/truetype/ttinterp.c (Ins_ISECT): Use OVERFLOW_MUL_LONG, OVERFLOW_ADD_LONG, and OVERFLOW_SUB_LONG.
Werner Lemberg addb2ddd 2017-06-03T21:05:42 [base, cff, truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2060 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2062 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2063 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2068 * src/base/ftobjs.c (ft_glyphslot_grid_fit_metrics): Use OVERFLOW_ADD_LONG and OVERFLOW_SUB_LONG. * src/cff/cf2blues.c (cf2_blues_capture), src/cff/cf2hints.c (cf2_hintmap_adjustHints): Use OVERFLOW_SUB_INT32. * src/truetype/ttgload.c (compute_glyph_metrics): User OVERFLOW_SUB_LONG. * src/truetype/ttinterp.c (Direct_Move, Direct_Move_Orig, Direct_Move_X, Direct_Move_Y, Direct_Move_Orig_X, Direct_Move_Orig_Y, Move_Zp2_Point, Ins_MSIRP): Use OVERFLOW_ADD_LONG and OVERFLOW_SUB_LONG.
Werner Lemberg 1ea34322 2017-06-03T06:52:13 [cff, truetype] Integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2047 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2057 * src/cff/cf2hints.c (cf2_hintmap_map): Use OVERFLOW_SUB_INT32. * src/truetype/ttinterp.c (Ins_ADD): Use OVERFLOW_ADD_LONG. (Ins_SUB): Use OVERFLOW_SUB_LONG. (Ins_NEG): Use NEG_LONG.
Werner Lemberg 0716c6ab 2017-06-02T19:24:03 [cff] Even more integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2046 * src/cff/cf2intrp.c (cf2_doStems, cf2_interpT2CharString): Use OVERFLOW_ADD_INT32.
Werner Lemberg 7a4276fb 2017-06-02T09:21:37 [cff] More integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2032 * src/cff/cf2blues.c (cf2_blues_init): Use OVERFLOW_SUB_INT32.
Werner Lemberg 3802ca8b 2017-06-02T08:44:20 [cff] Fix integer overflows. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2027 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2028 * src/cff/cf2hints.c (cf2_hintmap_insertHint), src/cff/cf2intrp.c (cf2_doFlex): Use OVERFLOW_ADD_INT32 and OVERFLOW_SUB_INT32.
Werner Lemberg e66d7300 2017-05-31T16:16:50 [cff] 32bit integer overflow run-time errors 2/2 (#46149). This commit handles the new engine. * include/freetype/internal/ftcalc.h (OVERFLOW_ADD_INT32, OVERFLOW_SUB_INT32, OVERFLOW_MUL_INT32, NEG_INT, NEG_LONG, NEG_INT32): New macros. * src/cff/cf2ft.c (cf2_getScaleAndHintFlag): Use OVERFLOW_ADD_INT32. * src/cff/cf2hints.c (cf2_getWindingMomentum, cf2_hint_init, cf2_hintmap_map, cf2_glyphpath_hintPoint, cf2_glyphpath_computeIntersection, cf2_glyphpath_computeOffset, cf2_glyphpath_lineTo, cf2_glyphpath_curveTo): Use OVERFLOW_ADD_INT32, OVERFLOW_SUB_INT32, OVERFLOW_MUL_INT32, and NEG_INT32 where appropriate. * src/cff/cf2intrp.c (cf2_doFlex, cf2_doBlend, cf2_interpT2CharString): Ditto. Also add some other code where needed to avoid overflow.
Werner Lemberg 9b710cd5 2017-05-30T22:35:41 [cff] 32bit integer overflow run-time errors 1/2 (#46149). This commit handles the old engine. * src/cff/cffgload.c: Include FT_INTERNAL_CALC_H. (cff_decoder_parse_charstrings): Use OVERFLOW_ADD_LONG and OVERFLOW_SUB_LONG where needed. * src/cff/cffparse.c: Include FT_INTERNAL_CALC_H. (power_ten_limits): New static array. (do_fixed): Use it to prevent multiplication overflow. (cff_parser_run): Use OVERFLOW_ADD_LONG.
Werner Lemberg 2e4188d8 2017-05-28T07:46:22 [cff] s/cf2_floatToFixed/cf2_doubleToFixed/. The new name better describes what the macro actually does; additionally, we don't need a trailing `f' for literals (there was only a single such instance in the code, but this caused a clang warning because the macro itself uses `double' literals). * src/cff/cf2blues.c, src/cff/cf2blues.h, src/cff/cf2fixed.h, src/cff/cf2font.c, src/cff/cf2hints.c: Updated.
Werner Lemberg 5412d886 2017-04-22T12:48:50 Introduce `FT_Size_InternalRec' structure. We are going to extend this later on. * include/freetype/internal/ftobjs.h (FT_Size_InternalRec): New structure with a single field `module_data'. * src/base/ftobjs.c (FT_New_Size): Allocate `internal' field of `FT_Size' structure. * src/cff/cffgload.c (cff_builder_init, cff_decoder_prepare): Use `size->internal->module_data' instead of `size->internal'. * src/cff/cffobjs.c (cff_size_done): Deallocate `module_data'. (cff_size_init, cff_size_select, cff_size_request): Use `size->internal->module_data' instead of `size->internal'. * src/cif/cidobjs.c (cid_size_done, cid_size_init, cid_size_request): Use `size->internal->module_data' instead of `size->internal'. * src/psaux/psobjs.c (t1_builder_ini): Use `size->internal->module_data' instead of `size->internal'. * src/type1/t1objs.c (T1_Size_Done, T1_Size_Init, T1_Size_Request): Use `size->internal->module_data' instead of `size->internal'.
Werner Lemberg 5a3490e0 2017-03-31T09:35:58 * src/cff/cffload.c (cff_font_load): Improve fix from 2017-01-04. Allow CFFs containing a single font to have an empty font name. Problem reported by 張俊芝 <418092625@qq.com> in http://lists.nongnu.org/archive/html/freetype-devel/2017-03/msg00074.html
Werner Lemberg c8c67639 2017-03-30T21:07:17 * src/cff/cffparse.h (CFF2_DEFAULT_STACK): Set to 513 also. Requested by Dave Arnold.
Werner Lemberg 4c1b5dc1 2017-03-27T21:00:17 s/index/idx/ where appropriate.
Werner Lemberg dd64a622 2017-03-20T05:34:02 * src/cff/cffgload.c (cff_builder_init): Add safety guard (#50578).
Werner Lemberg 9931175d 2017-03-18T07:06:49 Improve `make multi'. * src/autofit/aflatin2.c: Guard file with FT_OPTION_AUTOFIT2. * src/base/ftmac.c: Guard more parts of the file with FT_MACINTOSH. * src/psaux/afmparse.c: Guard file with T1_CONFIG_OPTION_NO_AFM. * src/sfnt/pngshim.c: Guard file with TT_CONFIG_OPTION_EMBEDDED_BITMAPS also. * src/sfnt/ttbdf.c: Avoid empty source file. * src/sfnt/ttpost.c: Guard file with TT_CONFIG_OPTION_POSTSCRIPT_NAMES. * src/sfnt/ttsbit.c: Guard file with TT_CONFIG_OPTION_EMBEDDED_BITMAPS. * src/truetype/ttgxvar.c, src/truetype/ttinterp.c: Avoid empty source file. * src/truetype/ttsubpix.c: Guard file with TT_USE_BYTECODE_INTERPRETER also. * src/type1/t1afm.c: Guard file with T1_CONFIG_OPTION_NO_AFM. * src/autofit/autofit.c, src/base/ftbase.c, src/cache/ftcache.c, src/cff/cff.c, src/cid/type1cid.c, src/gxvalid/gxvalid.c, src/pcf/pcf.c, src/pfr/pfr.c, src/psaux/psaux.c, src/pshinter/pshinter.c, src/psnames/psnames.c, src/raster/raster.c, src/sfnt/sfnt.c, src/smooth/smooth.c, src/truetype/truetype.c, src/type1/type1.c, src/type42/type42.c: Remove conditionals; sort entries.
Werner Lemberg bffb7fe9 2017-03-17T07:52:30 `make multi' fixes; compiler warnings. * src/base/ftsnames.c: Include FT_INTERNAL_DEBUG_H. * src/cff/cffobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H and FT_SERVICE_MULTIPLE_MASTERS_H. * src/sfnt/sfdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H and FT_SERVICE_MULTIPLE_MASTERS_H. (get_win_string, get_apple_string): Initialize `result'.
Dave Arnold fdbef538 2017-03-17T07:28:11 [cff] Fix potential bugs in default NDV for CFF2. * src/cff/cffload.c (cff_blend_build_vector): Explicitly build blend vector when `lenNDV' is zero; don't rely on zero-init. Save `lenNDV' as part of cache key even when `lenNDV' is zero.
Dave Arnold 0bf95b58 2017-03-17T07:22:55 [cff] Fix CFF2 stack allocation. * src/cff/cffparse.c (cff_parser_init) add 1 for operator.
Werner Lemberg 981c23b7 2017-03-15T11:35:26 Remove clang compiler warnings (#50548). * include/freetype/internal/tttypes.h (TT_FaceRec): Make `var_postscript_prefix_len' unsigned. * src/autofit/afwarp.c (af_warper_compute_line_best): Remove redundant assignment. * src/cff/cffload.c (cff_subfont_load): Add casts. * src/cff/cffparse.c (cff_parse_blend): Remove redundant assignment. * src/sfnt/sfdriver.c (fmix32, murmur_hash_3_128): Add `static' keyword. Add casts. (fixed2float): Add cast. (sfnt_get_var_ps_name): Make `p' always initialized. Add casts. * src/truetype/ttgxvar.c (TT_Get_MM_Var): Add casts.
Werner Lemberg 5eb0fd5e 2017-03-12T20:46:56 [truetype] Store and use design coordinates also. * include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func): Add `normalizedcoords' argument. * src/truetype/ttgxvar.h (GX_BlendRec): Add `coords' field to store the design coordinates of the current instance. Updated. * src/truetype/ttgxvar.c (TT_Set_MM_Blend): Move functionality to... (tt_set_mm_blend): ... New function. Convert data in `normalizedcoords' array to `coords' array on demand. (TT_Set_Var_Design): Store argument data in `coords' array. (TT_Get_Var_Design): Get data from `coords' array. (tt_get_var_blend): Updated. (tt_done_blend): Updated. * src/cff/cffload.c, src/cff/cffload.h (cff_get_var_blend): Updated. * src/cff/cf2ft.c (cf2_getNormalizedVector): Updated. * src/cff/cffobjs.c (cff_face_init): Updated.
Werner Lemberg f0cee1a2 2017-02-23T08:23:39 * include/freetype/internal/tttypes.h (TT_Face): s/isCFF2/is_cff2/. For orthogonality with other structure field names. Update all users.
Werner Lemberg e706798d 2017-02-20T09:15:13 [cff] Finish support for `random' operator. * src/cff/cfftypes.h (CFF_SubFontRec): Add `random' field. * src/cff/cffobjs.c: Updated. (cff_driver_init): Initialize random seed value. * src/cff/cffload.c (cff_random): New function. (cff_subfont_load): Add `face' argument. Update all callers. Initialize random number generator with a proper seed value. (cff_font_load): Add `face' argument. Update all callers. * src/cff/cffload.h: Updated. * src/cff/cf2intrp.c (CF2_FIXME): Removed. (cf2_interpT2CharString) <cf2_escRANDOM>: Implement opcode. * src/cff/cffgload.c (cff_decoder_parse_charstrings): Don't initialize random seed value. <cff_op_random>: Use new random seed framework.
Werner Lemberg 156b30b1 2017-02-20T09:06:22 [cff] Sanitize `initialRandomSeed'. * src/cff/cffload.c (cff_load_private_dict): Make `initial_random_seed' value always positive.
Werner Lemberg 753e1131 2017-02-20T09:01:14 [cff] Introduce `random-seed' property (2/2). * src/base/ftobjs.c: Include `FT_CFF_DRIVER_H'. (open_face): Initialize `face->internal->random_seed'. (FT_Face_Properties): Handle `FT_PARAM_TAG_RANDOM_SEED'. * src/cff/cffdrivr.c (cff_property_set): Handle `random-seed' property.
Werner Lemberg ca1486c3 2017-02-20T08:55:26 [cff] Introduce `random-seed' property (1/2). We need this for support of the `random' operator. * include/freetype/ftcffdrv.h (FT_PARAM_TAG_RANDOM_SEED): New macro. * include/freetype/internal/ftobjs.h (FT_Face_InternalRec): New field `random_seed'. * src/cff/cffobjs.h (CFF_DriverRec): New field `random_seed'.
Werner Lemberg d22f5ec5 2017-02-18T10:43:10 Formatting.
Nikolaus Waxweiler 2b0ac189 2017-02-18T10:42:23 Add face property for stem darkening. * include/freetype/ftautoh.h (FT_PARAM_TAG_STEM_DARKENING): New macro. * include/freetype/internal/ftobjs.h (FT_Face_InternalRec): Add `no_stem_darkening' field. * src/autofit/afloader.c (af_loader_load_glyph), src/autofit/afmodule.c (af_property_set): Updated. * src/base/ftobjs.c: Include FT_AUTOHINTER_H. (ft_open_face_internal): Updated. (FT_Face_Properties): Handle FT_PARAM_TAG_STEM_DARKENING. * src/cff/cf2ft.c (cf2_decoder_parse_charstrings): Updated. * src/cff/cffdrivr.c (cff_property_set): Updated.
Werner Lemberg dadc50a4 2017-02-02T07:13:29 Make compilation with FT_CONFIG_OPTION_PIC work again. All code committed here is guarded with `FT_CONFIG_OPTION_PIC'. * include/freetype/internal/services/svmetric.h (FT_DEFINE_SERVICE_METRICSVARIATIONSREC): Remove trailing semicolon. * src/autofit/aflatin.c (af_latin_hints_compute_edges, af_latin_hint_edges): Provide `globals' variable. * src/autofit/afloader.c (af_loader_load_glyph): Remove shadowing variable. * src/autofit/afmodule.c (AF_SCRIPT_CLASSES_GET, AF_STYLE_CLASSES_GET): Redefine. * src/autofit/aftypes.h (AF_DEFINE_WRITING_SYSTEM_CLASS): Fix typo. * src/cff/cffparse.c (CFF_FIELD_BLEND): Provide it. * src/cff/cffpic.h (CffModulePIC): Fix typo.
Werner Lemberg fa437d8d 2017-01-31T23:06:38 [cff] Provide metrics variation service interface (#50196). Only now I've got an OTF with an HVAR table for testing... The code in `ftmm.c' uses `FT_FACE_LOOKUP_SERVICE' to get the metrics variations interface. However, this didn't work with `FT_FACE_FIND_GLOBAL_SERVICE' used in `sfnt_init_face'. * src/cff/cffdrivr.c: Include FT_SERVICE_METRICS_VARIATIONS_H. (cff_hadvance_adjust, cff_metrics_adjust): Wrapper functions for metric service functions from the `truetype' module. (cff_service_metrics_variations): New service. (cff_services): Updated. * src/cff/cffpic.h (CFF_SERVICE_METRICS_VAR_GET): New macro. [FT_CONFIG_OPTION_PIC]: Synchronize code. * src/sfnt/sfobjs.c (sfnt_init_face): Replace call to FT_FACE_FIND_GLOBAL_SERVICE with `ft_module_get_service' to always load the service from the `truetype' module.
Alexei Podtelezhnikov a32270ae 2017-01-19T23:01:44 Typos.
Werner Lemberg 563ae780 2017-01-04T20:16:34 Update copyright year.
Werner Lemberg c9d47724 2017-01-04T10:00:49 [cff] More consistency checks for pure CFFs. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=378 * src/cff/cffload.c (cff_font_load): Check element number and size of Name and Top DICT indices.
Werner Lemberg 025226ae 2017-01-04T07:45:44 [cff, truetype] Minor tracing improvement. * src/cff/cffobjs.c (cff_face_init), src/truetype/ttobjs.c (tt_face_init): Indent first tracing message from SFNT driver.
Werner Lemberg 69414e7a 2017-01-03T06:53:13 * src/cff/cffparse.c (cff_parse_num): Simplify.
Werner Lemberg 248eaa4f 2017-01-03T00:27:07 Various fixes for clang's undefined behaviour sanitizer. * src/cff/cffload.c (FT_fdot14ToFixed): Fix casting. (cff_blend_doBlend): Don't left-shift negative numbers. Handle 5-byte numbers byte by byte to avoid alignment issues. * src/cff/cffparse.c (cff_parse): Handle 5-byte numbers byte by byte to avoid alignment issues. * src/cid/cidload (cid_read_subrs): Do nothing if we don't have any subrs. * src/psaux/t1decode.c (t1_decode_parse_charstring): Fix tracing. * src/tools/glnames.py (main): Put `DEFINE_PSTABLES' guard around definition of `ft_get_adobe_glyph_index'. * src/psnames/pstables.h: Regenerated. * src/psnames/psmodule.c: Inlude `pstables.h' twice to get both declaration and definition. * src/truetype/ttgxvar.c (FT_fdot14ToFixed, FT_intToFixed): Fix casting.
Werner Lemberg bdec162d 2017-01-01T20:51:55 [cff] Handle multiple `blend' operators in a row correctly. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=368 * src/cff/cffload.c (cff_blend_doBlend): Adjust `parser->stack' pointers into `subFont->blend_stack' after reallocation.
Werner Lemberg 84b0d992 2016-12-29T10:38:51 */*: Use `0.5f' for tracing 16.16 numbers.
Werner Lemberg c4a1ef3c 2016-12-28T21:22:45 [cff] Catch `blend' op in non-variant fonts. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=334 * src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdBLEND>: Don't allow `blend' op for non-variant fonts.
Werner Lemberg c4cd34a9 2016-12-28T08:33:35 [cff] Better check of number of blends. * src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdBLEND>, src/cff/cffparse.c (cff_parse_blend): Compare number of blends with stack size.
Werner Lemberg f80c4473 2016-12-26T23:57:45 Replace `++foo' and `--foo' with `foo++' and `foo--', resp.
Werner Lemberg 4441f7b2 2016-12-26T17:08:17 Replace `foo == NULL' and `foo != NULL' with `!foo' and `foo', resp. Other minor formatting.
Werner Lemberg 37c72f66 2016-12-25T22:55:25 Minor formatting.
Werner Lemberg b44e6c20 2016-12-22T08:30:15 [cff] Protect against invalid `vsindex' and `blend' values. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=305 * src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdVSINDEX, cf2_cmdBLEND>: Implement it.
Werner Lemberg e6a429e2 2016-12-21T20:27:48 [cff, truetype] Another try for #49829. * src/cff/cffdrivr.c: Don't include `FT_SERVICE_METRICS_VARIATIONS_H'. (cff_get_advances): Use `ttface->variation_support'. * src/truetype/ttdriver.c (tt_get_advances): Use `ttface->variation_support'. * src/truetype/ttgload.c (TT_Process_Simple_Glyph, load_truetype_glyph): Use `ttface->variation_support'.
Werner Lemberg 70704b34 2016-12-20T12:27:22 [truetype] Improve logic for getting fast advance widths. * src/cff/cffdrivr.c (cff_get_advances), src/truetype/ttdriver.c (tt_get_advances): Use `is_default_instance' for test; this gets recomputed after changing blend coordinates.
Werner Lemberg a1e85f11 2016-12-20T10:52:26 [cff, truetype] Fast advance width retrieval for fonts with HVAR. Everything is guarded with TT_CONFIG_OPTION_GX_VAR_SUPPORT. * src/base/ftadvanc.c (LOAD_ADVANCE_FAST_CHECK): Don't handle MM. * src/cff/cffdrivr.c: Include FT_SERVICE_METRICS_VARIATIONS_H. (cff_get_advances): Test for HVAR and VVAR. * src/truetype/ttdriver.c (tt_get_advances): Test for HVAR and VVAR.
Werner Lemberg ca3d4019 2016-12-18T18:23:19 * src/cff/cffobjs.c (cff_face_init): Make named instances work.
Werner Lemberg a8652c59 2016-12-18T18:12:03 [truetype, cff] Extend `get_var_blend' function of MM service. In particular, we need access to named instance data. * include/freetype/internal/services/svmm.h (FT_Get_Var_Blend_Func): Add argument for `FT_MM_Var'. * src/cff/cffload.c (cff_get_var_blend): Updated. * src/cff/cffload.h: Updated. * src/cff/cf2ft.c (cf2_getNormalizedVector): Updated. * src/truetype/ttgxvar.c (tt_get_var_blend): Updated. Accept value `NULL' for arguments. * src/truetype/ttgxvar.h: Updated.
Werner Lemberg 8f633a08 2016-12-18T06:42:31 [cff] Better handling of non-CFF font formats. * src/cff/cffload.c (cff_font_load): Pure CFFs don't have a signature, so return `FT_Err_Unknown_File_Format' more often.
Werner Lemberg 4cd68179 2016-12-17T22:52:50 * src/cff/cffload.c (cff_build_blend_vector): Remove redundant code.
Werner Lemberg 6949797d 2016-12-17T21:05:54 More code formatting.
Werner Lemberg 5d664b6d 2016-12-17T20:47:42 Use FT_SET_ERROR where useful. Other minor code formatting.
Werner Lemberg 50ff6c1e 2016-12-17T07:44:46 * src/cff/cffload.c (cff_load_private_dict): Always init `blend'. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=295