summaryrefslogtreecommitdiff
path: root/pngwutil.c
diff options
context:
space:
mode:
authorJohn Bowler <jbowler@acm.org>2013-04-13 16:52:09 -0500
committerGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2013-04-13 16:52:09 -0500
commit70eb0720a04aa71eec6e97b568c8dd129d92c331 (patch)
treec01f297b3cb7a8fce42568c78c73c42dab19f1f1 /pngwutil.c
parent9bb775fc8cbde98fca150992efe227937b9278ff (diff)
downloadlibpng-70eb0720a04aa71eec6e97b568c8dd129d92c331.tar.gz
[libpng16] Fixed previous bugfix to work on 64-bit platforms.
Diffstat (limited to 'pngwutil.c')
-rw-r--r--pngwutil.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/pngwutil.c b/pngwutil.c
index 8f669374c..755ccef39 100644
--- a/pngwutil.c
+++ b/pngwutil.c
@@ -1745,9 +1745,13 @@ png_write_iTXt(png_structrp png_ptr, int compression, png_const_charp key,
{
if (comp.input_len > PNG_UINT_31_MAX-prefix_len)
png_error(png_ptr, "iTXt: uncompressed text too long");
- png_write_chunk_header(png_ptr, png_iTXt, strlen(text) + prefix_len);
+
+ /* So the string will fit in a chunk: */
+ comp.output_len = (png_uint_32)/*SAFE*/comp.input_len;
}
+ png_write_chunk_header(png_ptr, png_iTXt, comp.output_len + prefix_len);
+
png_write_chunk_data(png_ptr, new_key, key_len);
png_write_chunk_data(png_ptr, (png_const_bytep)lang, lang_len);