[libpng15] Fix Windows builds, add pngstest to Visual Studio and OpenWatcom

This commit is contained in:
John Bowler
2011-11-16 12:04:39 -06:00
committed by Glenn Randers-Pehrson
parent ed9f84475d
commit 89c2f84287
8 changed files with 634 additions and 114 deletions

View File

@@ -1342,44 +1342,6 @@ png_image_read_init(png_imagep image)
image->opaque = control;
return 1;
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
/* Prepare the reader to ignore all recognized chunks whose
* data will not be used, i.e., all chunks recognized by libpng
* except for IHDR, PLTE, IDAT, IEND, tRNS, bKGD, gAMA, cHRM,
* and sRGB.
*
* This provides a small performance improvement and eliminates
* any potential vulnerability to security problems in the unused
* chunks)
*/
{
static /* const */ png_byte chunks_to_ignore[] = {
104, 73, 83, 84, '\0', /* hIST */
105, 67, 67, 80, '\0', /* iCCP */
105, 84, 88, 116, '\0', /* iTXt */
111, 70, 70, 115, '\0', /* oFFs */
112, 67, 65, 76, '\0', /* pCAL */
112, 72, 89, 115, '\0', /* pHYs */
115, 66, 73, 84, '\0', /* sBIT */
115, 67, 65, 76, '\0', /* sCAL */
115, 80, 76, 84, '\0', /* sPLT */
116, 69, 88, 116, '\0', /* tEXt */
116, 73, 77, 69, '\0', /* tIME */
122, 84, 88, 116, '\0' /* zTXt */
};
/* Ignore unknown chunks */
png_set_keep_unknown_chunks(png_ptr,
1 /* PNG_HANDLE_CHUNK_NEVER */,
NULL, 0);
/* Ignore known but unused chunks */
png_set_keep_unknown_chunks(png_ptr,
1 /* PNG_HANDLE_CHUNK_NEVER */,
chunks_to_ignore, sizeof(chunks_to_ignore)/5);
}
#endif /* PNG_HANDLE_AS_UNKNOWN_SUPPORTED */
}
/* Error clean up */
@@ -1944,6 +1906,47 @@ png_image_read_end(png_voidp argument)
png_error(png_ptr, "png_read_image: unsupported transformation");
}
# ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
/* Prepare the reader to ignore all recognized chunks whose data will not
* be used, i.e., all chunks recognized by libpng except for those
* involved in basic image reading:
*
* IHDR, PLTE, IDAT, IEND
*
* Or image data handling:
*
* tRNS, bKGD, gAMA, cHRM, sRGB, iCCP and sBIT.
*
* This provides a small performance improvement and eliminates any
* potential vulnerability to security problems in the unused chunks.
*
* TODO: make it so that this is an explicit list to process, not a list
* to ignore?
*/
{
static PNG_CONST png_byte chunks_to_ignore[] = {
104, 73, 83, 84, '\0', /* hIST */
105, 84, 88, 116, '\0', /* iTXt */
111, 70, 70, 115, '\0', /* oFFs */
112, 67, 65, 76, '\0', /* pCAL */
112, 72, 89, 115, '\0', /* pHYs */
115, 67, 65, 76, '\0', /* sCAL */
115, 80, 76, 84, '\0', /* sPLT */
116, 69, 88, 116, '\0', /* tEXt */
116, 73, 77, 69, '\0', /* tIME */
122, 84, 88, 116, '\0' /* zTXt */
};
/* Ignore unknown chunks */
png_set_keep_unknown_chunks(png_ptr, 1 /* PNG_HANDLE_CHUNK_NEVER */,
NULL, 0);
/* Ignore known but unused chunks */
png_set_keep_unknown_chunks(png_ptr, 1 /* PNG_HANDLE_CHUNK_NEVER */,
chunks_to_ignore, (sizeof chunks_to_ignore)/5);
}
# endif /* PNG_HANDLE_AS_UNKNOWN_SUPPORTED */
/* Update the 'info' structure and make sure the result is as required; first
* make sure to turn on the interlace handling if it will be required
* (because it can't be turned on *after* the call to png_read_update_info!)