mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng16] Renamed contrib/tools/fixitxt to contrib/tools/png-fix-itxt.
Added information in the documentation about problems with and fixes for the bad CRC and bad iTXt chunk situations.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#include <stdio.h>
|
||||
|
||||
/* fixitxt version 1.0.0
|
||||
/* png-fix-itxt version 1.0.0
|
||||
*
|
||||
* Copyright 2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.3 [(PENDING RELEASE)]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* fixitxt.exe < bad.png > good.png
|
||||
* png-fix-itxt.exe < bad.png > good.png
|
||||
*
|
||||
* Fixes a PNG file written with libpng-1.6.0 or 1.6.1 that has one or more
|
||||
* uncompressed iTXt chunks. Assumes that the actual length is greater
|
||||
@@ -22,8 +22,14 @@
|
||||
*
|
||||
* Requires zlib (for crc32 and Z_NULL); build with
|
||||
*
|
||||
* gcc -O -o fixitxt fixitxt.c -lz
|
||||
* gcc -O -o png-fix-itxt png-fix-itxt.c -lz
|
||||
*
|
||||
* If you need to handle iTXt chunks larger than 500000 kbytes you must
|
||||
* rebuild png-fix-itxt with a larger values of MAX_LENGTH (or a smaller value
|
||||
* if you know you will never encounter such huge iTXt chunks).
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#define MAX_LENGTH 500000
|
||||
@@ -691,8 +691,8 @@ fix_one(FILE *fp, FILE *fpIn, IDAT_info *info, png_uint_32 max_IDAT, int strip)
|
||||
}
|
||||
} /* while len > 0 && state < 4 */
|
||||
|
||||
/* The above loop only exits on 0 bytes left or end of stream, if
|
||||
* the stream ended with bytes left discard them:
|
||||
/* The above loop only exits on 0 bytes left or end of stream. If
|
||||
* the stream ended with bytes left, discard them:
|
||||
*/
|
||||
if (len > 0)
|
||||
{
|
||||
@@ -723,7 +723,7 @@ fix_one(FILE *fp, FILE *fpIn, IDAT_info *info, png_uint_32 max_IDAT, int strip)
|
||||
case 1: /* Keep gAMA, sRGB */
|
||||
if (tag == png_gAMA || tag == png_sRGB)
|
||||
break;
|
||||
/* Fall trhough */
|
||||
/* Fall through */
|
||||
|
||||
default: /* Keep only IHDR, PLTE, tRNS */
|
||||
if (tag == png_IHDR || tag == png_PLTE || tag == png_tRNS)
|
||||
|
||||
Reference in New Issue
Block a user