diff options
Diffstat (limited to 'contrib/tools/pngfix.c')
-rw-r--r-- | contrib/tools/pngfix.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/contrib/tools/pngfix.c b/contrib/tools/pngfix.c index 2fa5d13ea..54a467daf 100644 --- a/contrib/tools/pngfix.c +++ b/contrib/tools/pngfix.c @@ -1,6 +1,5 @@ /* pngfix.c * - * Last changed in libpng 1.6.31 [July 27, 2017] * Copyright (c) 2014-2017 John Cunningham Bowler * * This code is released under the libpng license. @@ -10,6 +9,7 @@ * Tool to check and fix the zlib inflate 'too far back' problem. * See the usage message for more information. */ + #include <stdlib.h> #include <stdio.h> #include <string.h> @@ -1598,7 +1598,7 @@ chunk_init(struct chunk * const chunk, struct file * const file) chunk->chunk_length = file->length; chunk->chunk_type = file->type; - /* Compresssed/uncompressed size information (from the zlib control structure + /* Compressed/uncompressed size information (from the zlib control structure * that is used to check the compressed data in a chunk.) */ chunk->uncompressed_digits = 0; @@ -2929,7 +2929,7 @@ process_chunk(struct file *file, png_uint_32 file_crc, png_uint_32 next_length, } /* Control reaches this point if the chunk must be skipped. For chunks other - * than IDAT this means that the zlib compressed data is fatally damanged and + * than IDAT this means that the zlib compressed data is fatally damaged and * the chunk will not be passed to libpng. For IDAT it means that the end of * the IDAT stream has not yet been reached and we must handle the next * (IDAT) chunk. If the LZ data in an IDAT stream cannot be read 'stop' must @@ -3961,6 +3961,14 @@ main(int argc, const char **argv) { size_t outlen = strlen(*argv); + if (outlen > FILENAME_MAX) + { + fprintf(stderr, "%s: output file name too long: %s%s%s\n", + prog, prefix, *argv, suffix ? suffix : ""); + global.status_code |= WRITE_ERROR; + continue; + } + if (outfile == NULL) /* else this takes precedence */ { /* Consider the prefix/suffix options */ @@ -4046,4 +4054,3 @@ main(void) return 77; } #endif /* PNG_SETJMP_SUPPORTED */ - |