TurboJPEG: Expose/extend hidden "max pixels" param

TJPARAM_MAXPIXELS was previously hidden and used only for fuzz testing,
but it is potentially useful for calling applications as well,
particularly if they want to guard against excessive memory consumption
by the tj3LoadImage*() functions.  The parameter has also been extended
to decompression and lossless transformation functions/methods, mainly
as a convenience.  (It was already possible for calling applications to
impose their own JPEG image size limits by reading the JPEG header prior
to decompressing or transforming the image.)
This commit is contained in:
DRC
2023-11-16 15:36:47 -05:00
parent 6136a9e285
commit 55d342c788
41 changed files with 409 additions and 309 deletions

View File

@@ -787,6 +787,21 @@ public final class TJ {
* </ul>
*/
public static final int PARAM_MAXMEMORY = 23;
/**
* Image size limit [decompression, lossless transformation]
*
* <p>Setting this parameter will cause the decompression and transform
* operations to throw an error if the number of pixels in the JPEG source
* image exceeds the specified limit. This allows security-critical
* applications to guard against excessive memory consumption.
*
* <p><b>Value</b>
* <ul>
* <li> maximum number of pixels that the decompression and transform
* operations will process <i>[default: <code>0</code> (no limit)]</i>
* </ul>
*/
public static final int PARAM_MAXPIXELS = 24;
/**