summaryrefslogtreecommitdiff
path: root/jbig2dec/jbig2_segment.c
Commit message (Collapse)AuthorAgeFilesLines
* Update postal address in file headersChris Liddell2023-04-041-3/+3
|
* Update copyright to 2021Chris Liddell2021-03-151-1/+1
|
* jbig2dec: Free result object upon error allocating referred to segments.Sebastian Rasmussen2020-06-231-0/+1
|
* Bug 702335: jbig2dec: Refill input buffer upon failure to parse segment header.Sebastian Rasmussen2020-04-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Before commit 2b2dcf4ccf401ed210f03c858b304994749fd2b3 there was a debug message when attempting to parse a a segment header and the data supplied to jbig2dec was not enough. Commit 2b2dcf4 incorrectly changed the debug message into a fatal error message, due misinterpreting the message text as something that warranted a fatal error. When data was supplied in chunks to jbig2_data_in() in repeated calls such that a segment header's referred-to segment numbers field straddled a chunk boundary then jbig2dec would indicate a fatal error. The file in bug 702335 caused this to happen. Instead jbig2dec should be asking the caller for more data so that the entire segment header can be parsed during a single call to jbig2_data_in(). By convering the fatal error back to a a debug message the problem is resolved. The message itself is also rewored to clearly indicate that the situation is non-fatal and that the caller will be asked to provide more data.
* Update copyright to 2020Chris Liddell2020-04-101-1/+1
|
* jbig2dec: Pass segment numbers as unsigned values to error callback.Sebastian Rasmussen2020-03-201-1/+6
| | | | | | | | | | | | | According to the JBIG2 specification segments numbers are 32 bit unsigned integer. Previously any segment numbers larger than INT32_MAX would be passed as negative numbers. Some parts of the decoder do not yet know, or do not have access to the currently decoded segment number, and this needs to be specially indicated. Therefore jbig2dec appropriates the unlikely segment number 0xffffffff to indicate an unknown segment number. This is a change of the public API.
* jbig2dec: Use unsigned suffix when defining UINT32_MAX.Sebastian Rasmussen2020-03-201-4/+0
| | | | | Also move UINT32_MAX/INT32_MAX to internal header so they are defined (the same) in every jbig2 source code file.
* Fix some -W -Wall warnings about printf format type mismatches.Julian Smith2019-11-221-1/+1
|
* Coverity 350210: removed superflous extra param to jbig2_error().Julian Smith2019-11-201-1/+1
|
* Update source/header file copyright notice to 2019Chris Liddell2019-01-161-1/+1
|
* jbig2dec: Read region segment height/width/x/y as unsigned.Sebastian Rasmussen2018-07-311-4/+4
| | | | | | | The specification in 5.4.4 states that numbers are unsigned unless otherwise stated. 7.4.1.1 through 7.4.1.4 specifying the region segment height, width, x and y do not mention that these fields are signed, hence they ought to read and handled as unsigned.
* jbig2dec: Rephrase jbig2_error() messages.Sebastian Rasmussen2018-07-311-3/+3
| | | | | | | | | | | | * Do not prefix messages with "jbig2 error:", this ought to be done by the error callback itself. * Avoid using function names in messages as they mean nothing to the end user. * Avoid contractions in messages. * Try to adhere to "failed to" pattern as far as possible. * Messages start with lower case character, unless it refers to something in the specification. * Messages do not end with punctuation.
* JBIG2DEC - add declarations which are not defined in VS 2005Ken Sharp2018-07-191-0/+4
| | | | | | Like INT32_MAX and INT32_MIN, UINT32_MAX which is defined in stdint.h is not defined for old versions of Visual Studio. Add simple definitions in the two source files that use it, if it is not already defined.
* jbig2dec: Ignore extension segments that are not marked necessary.Sebastian Rasmussen2018-07-191-1/+1
| | | | | | Previously this was a fatal error, but it is better as a warning as the extension segment has not been marked necessary as outlined in the specification.
* jbig2dec: Use already parsed size of page association field.Sebastian Rasmussen2018-07-191-1/+1
|
* jbig2dec: Handle immediate generic regions with unknown height.Sebastian Rasmussen2018-07-191-0/+1
|
* jbig2dec: Print segment number in messages when available.Sebastian Rasmussen2018-07-161-1/+1
|
* jbig2dec: Remove untested, incomplete metadata handling.Sebastian Rasmussen2018-07-131-7/+6
|
* jbig2dec: Return NULL upon error, avoid returning variable.Sebastian Rasmussen2018-07-131-1/+1
| | | | This makes it clearer what is being returned upon error.
* jbig2dec: Label everything not yet implemented NYI.Sebastian Rasmussen2018-07-131-2/+2
|
* jbig2dec: Implement support for profile segment.Sebastian Rasmussen2018-07-131-1/+86
| | | | | The information in the profile segment is simply printed as informational messages via jbig2_error().
* jbig2dec: Check for T.88 amendments 2/3 bitstreams.Sebastian Rasmussen2018-07-131-0/+2
| | | | | | | T.88 Amendment 2 adds up to 12 adaptive template pixels in generic regions. T.88 Amendment 3 adds support for generic/text regions to encode colors. Neither amendment is implemented and no sample files have been found. Return fatal errors for such bitstreams/files for the time being.
* jbig2dec: Clarify lack of support for dependency bit.Sebastian Rasmussen2018-07-131-1/+4
| | | | | | | | The extension segment dependency bit only matters for encoders. This is because it informs the encoder what other segments a specific segment depends on. Since jbig2dec doesn't do any alteration of segments this need not be supported (or indeed even parsed).
* jbig2dec: free/release functions must handle NULL argument.Sebastian Rasmussen2018-07-131-1/+3
|
* jbig2dec: Unsupported intermediate generic region is now a fatal error.Sebastian Rasmussen2018-07-131-1/+1
|
* jbig2dec: Only return jbig2_error() for fatal errors/warnings.Sebastian Rasmussen2018-07-131-1/+1
| | | | | | | Only calls to jbig2_error() using fatal errors or warnings may return, no calls to jbig2_error() using informational or debug messages may return. This is preparation for jbig2_error() to always return -1 for errors/warnings.
* jbig2dec: Avoid NULL-check before jbig2_free()/jbig2_image_release().Sebastian Rasmussen2018-07-131-3/+2
|
* jbig2dec: Move declarations from jbig2_priv.h to their respective headers.Sebastian Rasmussen2018-07-131-4/+9
| | | | Due to this some .c-files now need new includes.
* jbig2dec: Create jbig2_segment.h with segment declarations.Sebastian Rasmussen2018-07-131-0/+1
|
* jbig2dec: Create jbig2_refinement.h with refinement declarations.Sebastian Rasmussen2018-07-131-0/+1
|
* jbig2dec: Create jbig2_page.h with page declarations.Sebastian Rasmussen2018-07-131-0/+1
|
* jbig2dec: Rephrase error messages.Sebastian Rasmussen2018-07-131-2/+2
|
* jbig2dec: Remove unnecessary comments, whitespace and unused code.Sebastian Rasmussen2018-07-131-2/+2
|
* jbig2dec: Detect data shortage.Sebastian Rasmussen2018-04-111-4/+10
|
* jbig2dec: Improve error handling.Sebastian Rasmussen2018-04-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some functions detected errors but would not return these to the caller. These functions may now indicate errors: jbig2_arith_decode(), jbig2_image_resize() Errors detected by following functions were not always handled, but they are now handled properly: jbig2_arith_decode(), jbig2_arith_iaid_decode() jbig2_arith_int_ctx_new(), jbig2_build_huffman_table() jbig2_complete_page(), jbig2_image_compose() jbig2_decode_refinement_region(), jbig2_ctx_new() jbig2_image_resize(), jbig2_image_write_pbm() jbig2_image_write_pbm_file(), jbig2_image_write_png() jbig2_image_write_png_file(), jbig2_metadata_add() jbig2_page_add_result(), jbig2_renew() jbig2_strndup() Some functions detected errors but did not fail early enough: jbig2_decode_pattern_dict(), jbig2_decode_halftone_region() jbig2_decode_mmr_line() detected errors but did not produce suitable error messages. This has been rectified. Finally, if a subfunction indicates an error by returning an error code, the calling function will report a warning and return, indicating failure.
* jbig2dec: Fix some cosmetic typos in code/headers/tests.Sebastian Rasmussen2018-04-101-1/+1
|
* Update copyright notice with new head office address.Ken Sharp2018-01-301-3/+3
| | | | | | | | | Also update copyright dates. Remove gs_cmdl.ps as we no longer use it, and remove its entry from psfiles.htm. Remove xfonts.htm as this feature (xfont support) is long, long gone.
* Squash signed/unsigned warnings in MSVC jbig2 build.Robin Watts2016-12-131-5/+5
| | | | | Also rename "new" to "new_dict", because "new" is a bad variable name.
* Reindent jbig2dec source to follow gs coding style.Tor Andersson2016-04-081-202/+171
| | | | | | | | | | | | First a pass through gnu indent: indent \ -bad -nbap -nsob -br -ce -cli0 \ -npcs -ncs -i4 -di0 -psl -lp -lps -nut -l160 \ *.c *.h Followed by astyle to patch over some of the indentation bugs in gnu indent: astyle --style=kr -H -U -k3 *.c *.h
* Squash Warnings: JBig2Robin Watts2016-01-041-2/+3
| | | | | | ifdef out some used code. Make some functions static that should be.
* Commit of build_consolidation branchChris Liddell2015-07-201-0/+303
Squashed into one commit (see branch for details of the evolution of the branch). This brings gpcl6 and gxps into the Ghostscript build system, and a shared set of graphics library object files for all the interpreters. Also, brings the same configuration options to the pcl and xps products as we have for Ghostscript.