[libpng15] Fixed a minor bug in types to malloc and major bug in handling

compressed iTXt. Compressed iTXt could not be handled. Change was made
earlier but omitted from libpng-1.5.14beta02 distributions.
This commit is contained in:
Glenn Randers-Pehrson
2012-12-15 11:09:44 -06:00
parent c53980584e
commit a2669c39c3
4 changed files with 28 additions and 21 deletions

View File

@@ -460,24 +460,21 @@ png_text_compress(png_structp png_ptr,
old_ptr = comp->output_ptr;
comp->output_ptr = (png_bytepp)png_malloc(png_ptr,
(png_alloc_size_t)
(comp->max_output_ptr * png_sizeof(png_charpp)));
(comp->max_output_ptr * png_sizeof(png_bytep)));
png_memcpy(comp->output_ptr, old_ptr, old_max
* png_sizeof(png_charp));
* png_sizeof(png_bytep));
png_free(png_ptr, old_ptr);
}
else
comp->output_ptr = (png_bytepp)png_malloc(png_ptr,
(png_alloc_size_t)
(comp->max_output_ptr * png_sizeof(png_charp)));
(comp->max_output_ptr * png_sizeof(png_bytep)));
}
/* Save the data */
comp->output_ptr[comp->num_output_ptr] =
(png_bytep)png_malloc(png_ptr,
(png_alloc_size_t)png_ptr->zbuf_size);
(png_bytep)png_malloc(png_ptr, png_ptr->zbuf_size);
png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf,
png_ptr->zbuf_size);