src/bzip2/ftbzip2.c


Log

Author Commit Date CI Message
Ben Wagner 6ee89519 2022-01-12T15:12:53 [bzip2] Reset bzip stream on any error. According to the bzip documentation it is undefined what will happen if `BZ2_bzDecompress` is called on a `bz_stream` it has previously returned an error against. If `BZ2_bzDecompress` returns anything other than `BZ_OK` the only valid next action is `BZ2_bzDecompressEnd`. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43564 * src/bzip2/ftbzip2.c (FT_BZip2FileRec_): Add `reset` to track the need to reset the stream. (ft_bzip2_file_init): Initialize `reset` to 0. (ft_bzip2_file_reset): Set `reset` to 0 after resetting. (ft_bzip2_file_fill_output): Set `reset` to 1 when `BZ2_bzDecompress` returns anything other than `BZ_OK`.
Ben Wagner f1d3b9f1 2022-01-11T17:15:35 Revert "[bzip2] Avoid use of uninitialized memory." This reverts commit d276bcb7f0c02c20d3585b2e5626702df6d140a6. The original commit did avoid the use of uninitialized memory. However, it appears that the original commit is no longer required. The underlying issue was resolved by a change in freetype2-testing "Build bzip2 correctly." [0]. Prior to [0] bzip2 was built without msan, so bzip2 writes were not tracked or considered initialized. Clearing `buffer` in the original commit allowed msan to see the `buffer` content initialized once in FreeType code, but msan saw no writes into buffer from bzip2. With bzip2 now built with msan, the bzip2 writes are properly instrumented and msan sees the bzip2 writes into the buffer. As a result the original commit can be safely reverted to allow for better detection of other uninitialized data scenarios. * src/bzip2/ftbzip2.c (FT_Stream_OpenBzip2): Revert to using `FT_QNEW`. [0] https://github.com/freetype/freetype2-testing/commit/3c052a837a3c960709227a0d6ddd256e87b88853
Werner Lemberg d0cfb4e1 2022-01-11T10:54:10 Update all copyright notices.
Werner Lemberg d276bcb7 2022-01-09T07:48:59 [bzip2] Avoid use of uninitialized memory. * src/bzip2/ftbzip2.c (FT_Stream_OpenBzip2): Don't use `FT_QNEW` but `FT_NEW` for setting up `zip` to avoid uninitialized memory access while handling malformed PCF fonts later on. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=42800
Alexei Podtelezhnikov 49270c17 2021-09-14T21:32:43 Replace boolean allocation macros with MEM ones. * src/base/ftbitmap.c (FT_Bitmap_Copy): Use MEM-macro. * src/base/ftobjs.c (ft_glyphslot_alloc_bitmap): Ditto. * src/bzip2/ftbzip2.c (ft_bzip2_alloc): Ditto. * src/cache/ftccache.c (ftc_cache_init): Ditto * src/gzip/ftgzip.c (ft_gzip_alloc): Ditto. * src/psnames/psmodule.c (ps_unicodes_init): Ditto. * src/sfnt/sfobjs.c (sfnt_load_face): Ditto. * src/sfnt/ttload.c (tt_face_load_name): Ditto.
Alexei Podtelezhnikov 612925ff 2021-09-01T21:37:21 s/0/NULL/ where appropriate.
Werner Lemberg c2fa51d9 2021-07-24T20:32:16 Fix some `cppcheck` warnings. * src/bzip2/ftbzip2.c (ft_bzip2_file_skip_output), src/gzip/ftgzip.c (ft_gzip_file_skip_output): Reduce scope of `delta`. * src/psaux/psintrp.c, src/psaux/psintrp.h (cf2_interpT2CharString): Add `const` to `buf` parameter. * src/raster/ftraster.c (DelOld): Add `const` to `profile` parameter. (Vertical_Sweep_Span): Reduce scope of `target`. (FT_Outline_Get_CBox): Reduce scope of `xMin`, `xMax`, `yMin`, `yMax`. * src/smooth/ftgrays.c (gray_render_conic): Reduce scope of `split`. (gray_sweep, gray_sweep_direct): Reduce scope of `area`. * src/tools/apinames.c (names_dump) <OUTPUT_WATCOM_LBC>: Reduce scope of `temp`.
Alexei Podtelezhnikov 1e525c62 2021-04-23T08:24:22 [bzip2,gzip] s/FT_ALLOC/FT_QALLOC/ for initialized buffers. * src/bzip2/ftbzip2.c (ft_bzip2_alloc): Do not zero out the buffer. * src/gzip/ftgzip.c (ft_gzip_alloc, FT_Stream_OpenGzip): Ditto.
Werner Lemberg b6e8a712 2021-01-17T07:18:48 Update all copyright notices.
Werner Lemberg 16586859 2020-06-13T21:15:45 Remove redundant inclusion of `ft2build.h'. * */*: Remove `#include <ft2build.h>' where possible. * include/freetype/freetype.h: Remove cpp error about missing inclusion of `ft2build.h'.
David Turner e1339133 2020-06-08T13:31:55 Make macros for header file names optional. We no longer have to take care of the 8.3 file name limit; this allows us (a) to introduce longer, meaningful file names, and (b) to avoid macro names in `#include' lines altogether since some compilers (most notably Visual C++) doesn't support this properly. */*: Replace #include FOO_H with #include <freetype/foo.h> or something similar. Also update the documentation.
Werner Lemberg e5038be7 2020-01-19T17:05:19 Update all copyright notices.
Werner Lemberg 75859970 2019-02-23T10:07:09 Update all copyright notices.
Werner Lemberg f686ad46 2019-01-22T20:31:44 Update copyright years.
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 0a0c2256 2018-01-02T09:33:57 Update copyright year.
Werner Lemberg 563ae780 2017-01-04T20:16:34 Update copyright year.
Werner Lemberg 4441f7b2 2016-12-26T17:08:17 Replace `foo == NULL' and `foo != NULL' with `!foo' and `foo', resp. Other minor formatting.
Werner Lemberg 9adeab64 2016-01-13T11:54:10 Update copyright year.
Werner Lemberg 37412ff9 2016-01-12T21:37:13 Don't use macro names that contain `__' [1/2]. Such macro names are reserved for both C and C++. */*: Replace macros of the form `__XXX_H__' with `XXX_H_'.
Werner Lemberg b260dc9f 2015-10-04T07:39:22 [bzip2, gzip] Avoid access of unitialized memory (#46109). * src/bzip2/ftbzip2.c (ft_bzip2_file_fill_input), src/gzip/ftgzip.c (ft_gzip_file_fill_input): In case of an error, adjust the limit to avoid copying uninitialized memory.
Werner Lemberg 53838ce0 2015-10-03T21:12:25 [bzip2, gzip] Avoid access of unitialized memory (#46109). * src/bzip2/ftbzip2.c (ft_bzip2_file_fill_output), src/gzip/ftgzip.c (ft_gzip_file_fill_output): In case of an error, adjust the limit to avoid copying uninitialized memory.
Werner Lemberg 41877539 2015-09-26T15:19:54 [bzip2, gzip, lzw] Harmonize function signatures with prototype. Suggested by Hin-Tak Leung. * src/bzip2/ftbzip2.c (ft_bzip2_stream_io), src/gzip/ftgzip.c (ft_gzip_stream_io), src/lzw/ftlzw.c (ft_lzw_stream_io): Do it.
Werner Lemberg 3e587796 2015-03-11T07:14:15 Minor copyright and e-mail address issues.
Werner Lemberg 5c9d9bf2 2015-02-25T08:13:40 * src/bzip2/ftbzip2.c (ft_bzip2_alloc): Signedness fix.
Werner Lemberg f57fc59e 2015-01-17T20:41:43 Run `src/tools/update-copyright'.
Werner Lemberg 0098d550 2014-12-07T11:03:57 Uppercase all hex digits for orthogonality.
Werner Lemberg f34f1925 2014-11-26T21:59:21 * src/*: Add checks for parameters of API functions where missing. `API functions' are functions tagged with `FT_EXPORT_DEF'. Besides trivial fixes, the following changes are included, too. * src/base/ftbdf.c (FT_Get_BDF_Charset_ID, FT_Get_BDF_Property): Set error code if no service is available. * src/base/ftinit.c (FT_Done_FreeType): Change return value for invalid `library' parameter to `Invalid_Library_Handle'. * src/base/ftobjs.c (FT_New_Size): Change return value for invalid `asize' parameter to `Invalid_Argument'. * src/base/ftoutln.c (FT_Outline_Copy): Change return value for invalid `source' and `target' parameters to `Invalid_Outline'. (FT_Outline_Done_Internal): Change return value for invalid `outline' parameter to `Invalid_Outline'.
Werner Lemberg e3c93015 2013-03-14T11:21:17 */*: Use FT_Err_Ok only. This is a purely mechanical conversion.
Werner Lemberg 059bc335 2013-03-14T10:27:35 */*: Use `FT_THROW'. This is essentially a mechanical conversion, adding inclusion of `FT_INTERNAL_DEBUG_H' where necessary, and providing the macros for stand-alone compiling modes of the rasterizer modules. To convert the remaining occurrences of FT_Err_XXX and friends it is necessary to rewrite the code. Note, however, that it doesn't harm if some cases are not handled since FT_THROW is a no-op.
Vinnie Falco 26dfeb6d 2012-03-08T06:04:03 Prepare source code for amalgamation. * src\autofit\aferrors.h, src\bdf\bdferror.h, src\bzip2\ftbzip2.c, src\cache\ftcerror.h, src\cff\cfferrs.h, src\cid\ciderrs.h, src\gxvalid\gxverror.h, src\gzip\ftgzip.c, src\lzw\ftlzw.c, src\otvalid\otverror.h, src\pcf\pcferror.h, src\pfr\pfrerror.h, src\psaux\psauxerr.h, src\pshinter\pshnterr.h, src\psnames\psnamerr.h, src\raster\rasterrs.h, src\sfnt\sferrors.h, src\smooth\ftsmerrs.h, src\truetype\tterrors.h, src\type1\t1errors.h, src\type42\t42error.h, src\winfonts\fnterrs.h: Add #undef FT_ERR_PREFIX before #define FT_ERR_PREFIX.
suzuki toshiya e62c876b 2011-06-15T02:48:33 Fix g++4.6 compiler warnings in module drivers. The background is same with previous commit. * src/truetype/ttgxvar.c (ft_var_readpackedpoints): Init `points'. (TT_Vary_Get_Glyph_Deltas): Init `delta_xy'. (TT_Get_MM_Var): Init `mmvar'. * src/type1/t1load.c (T1_Get_MM_Var): Ditto. * src/cff/cffdrivr.c (cff_ps_get_font_info): Init `font_info'. * src/cff/cffload.c (cff_index_get_pointers): Init `t'. (cff_font_load): Init `sub'. * src/cff/cffobjs.c (cff_size_init): Init `internal'. (cff_face_init): Init `cff'. * src/pfr/pfrload.c (pfr_extra_item_load_stem_snaps): Init `snaps'. * src/pcf/pcfread.c (pcf_get_properties): Init `properties'. (pcf_get_bitmaps): Init `offsets'. (pcf_get_encodings): Init `tmpEncoding'. * src/sfnt/ttload.c (tt_face_load_gasp): Init `gaspranges'. * src/sfnt/ttsbit.c (Load_SBit_Image): Init `components'. * src/cache/ftcmru.c (FTC_MruList_New): Init `node'. * src/gzip/ftgzip.c (FT_Stream_OpenGzip): Init `zip' and `zip_buff'. * src/lzw/ftlzw.c (FT_Stream_OpenLZW): Init `zip'. * src/bzip2/ftbzip2.c (FT_Stream_OpenBzip2): Init `zip'.
Joel Klinghed ed913c21 2010-12-31T16:59:33 Add bzip2 compression support to handle *.pcf.bz2 files. * builds/unix/configure.raw: Test for libbz2 library. * devel/ftoption.h, include/freetype/config/ftoption.h (FT_CONFIG_OPTION_USE_BZIP2): Define. * include/freetype/config/ftheader.h (FT_BZIP2_H): Define. * include/freetype/ftbzip2.h: New file. * src/bzip2/*: New files. * src/pcf/pcf.h: s/gzip_/comp_/. * src/pcf/pcfdrvr.c: Include FT_BZIP2_H. s/gzip_/comp_/. (PCF_Face_Init): Handle bzip2 compressed files. * docs/formats.txt, modules.cfg: Updated.