提交 d930d361 编写于 作者: G Glenn Randers-Pehrson

[libpng16] Restored png_get_eXIf_1() and png_set_eXIf_1() because strlen(eXIf_buf)

does not work (the eXIf chunk data can contain zeroes).
上级 a1fe2c98
......@@ -61,6 +61,8 @@ Version 1.6.32beta07 [Auguest 3, 2017]
Version 1.6.32beta08 [August 3, 2017]
Check length of IDAT against maximum possible IDAT size, accounting
for height, rowbytes, interlacing and zlib/deflate overhead.
Restored png_get_eXIf_1() and png_set_eXIf_1(), because strlen(eXIf_buf)
does not work (the eXIf chunk data can contain zeroes).
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
......
......@@ -5944,6 +5944,8 @@ Version 1.6.32beta07 [Auguest 3, 2017]
Version 1.6.32beta08 [August 3, 2017]
Check length of IDAT against maximum possible IDAT size, accounting
for height, rowbytes, interlacing and zlib/deflate overhead.
Restored png_get_eXIf_1() and png_set_eXIf_1(), because strlen(eXIf_buf)
does not work (the eXIf chunk data can contain zeroes).
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
......
......@@ -2014,6 +2014,10 @@ PNG_EXPORT(246, png_uint_32, png_get_eXIf, (png_const_structrp png_ptr,
png_inforp info_ptr, png_bytep *exif));
PNG_EXPORT(247, void, png_set_eXIf, (png_const_structrp png_ptr,
png_inforp info_ptr, const png_bytep exif));
PNG_EXPORT(248, png_uint_32, png_get_eXIf_1, (png_const_structrp png_ptr,
png_inforp info_ptr, png_uint_32 *num_exif, png_bytep *exif));
PNG_EXPORT(249, void, png_set_eXIf_1, (png_const_structrp png_ptr,
png_inforp info_ptr, png_uint_32 num_exif, const png_bytep exif));
#endif
#ifdef PNG_gAMA_SUPPORTED
......@@ -3259,7 +3263,7 @@ PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
* one to use is one more than this.)
*/
#ifdef PNG_EXPORT_LAST_ORDINAL
PNG_EXPORT_LAST_ORDINAL(247);
PNG_EXPORT_LAST_ORDINAL(249);
#endif
#ifdef __cplusplus
......
......@@ -777,12 +777,23 @@ png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr,
png_uint_32 PNGAPI
png_get_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
png_bytep *exif)
{
png_warning(png_ptr, "png_get_eXIf does not work; use png_get_eXIf_1");
PNG_UNUSED(info_ptr)
PNG_UNUSED(exif)
return 0;
}
png_uint_32 PNGAPI
png_get_eXIf_1(png_const_structrp png_ptr, png_inforp info_ptr,
png_uint_32 *num_exif, png_bytep *exif)
{
png_debug1(1, "in %s retrieval function", "eXIf");
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_eXIf) != 0 && exif != NULL)
{
*num_exif = info_ptr->num_exif;
*exif = info_ptr->exif;
return (PNG_INFO_eXIf);
}
......
......@@ -2078,7 +2078,7 @@ png_handle_eXIf(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
if (png_crc_finish(png_ptr, 0) != 0)
return;
png_set_eXIf(png_ptr, info_ptr, info_ptr->eXIf_buf);
png_set_eXIf_1(png_ptr, info_ptr, length, info_ptr->eXIf_buf);
png_free(png_ptr, info_ptr->eXIf_buf);
info_ptr->eXIf_buf = NULL;
......
......@@ -138,6 +138,15 @@ png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X,
void PNGAPI
png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
const png_bytep eXIf_buf)
{
png_warning(png_ptr, "png_set_eXIf does not work; use png_set_eXIf_1");
PNG_UNUSED(info_ptr)
PNG_UNUSED(eXIf_buf)
}
void PNGAPI
png_set_eXIf_1(png_const_structrp png_ptr, png_inforp info_ptr,
const png_uint_32 num_exif, const png_bytep eXIf_buf)
{
int i;
......@@ -152,7 +161,7 @@ png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
info_ptr->exif = NULL;
}
info_ptr->num_exif = (png_uint_32)strlen((const char *)eXIf_buf);
info_ptr->num_exif = num_exif;
info_ptr->exif = png_voidcast(png_bytep, png_malloc_warn(png_ptr,
info_ptr->num_exif));
......
......@@ -1201,16 +1201,15 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#ifdef PNG_READ_eXIf_SUPPORTED
{
png_bytep exif=NULL;
size_t exif_length;
png_uint_32 exif_length;
if (png_get_eXIf(read_ptr, read_info_ptr, &exif) != 0)
if (png_get_eXIf_1(read_ptr, read_info_ptr, &exif_length, &exif) != 0)
{
exif_length=strlen((const char *)exif);
if (exif_length > 1)
printf(" eXIf type %c%c, %lu bytes\n",exif[0],exif[1],
exif_length);
(unsigned long)exif_length);
# ifdef PNG_WRITE_eXIf_SUPPORTED
png_set_eXIf(write_ptr, write_info_ptr, exif);
png_set_eXIf_1(write_ptr, write_info_ptr, exif_length, exif);
# endif
}
}
......@@ -1562,14 +1561,13 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_bytep exif=NULL;
png_uint_32 exif_length;
if (png_get_eXIf(read_ptr, end_info_ptr, &exif) != 0)
if (png_get_eXIf_1(read_ptr, end_info_ptr, &exif_length, &exif) != 0)
{
exif_length=(png_uint_32)strlen((const char *)exif);
if (exif_length > 1)
printf(" eXIf type %c%c, %d bytes\n",exif[0],exif[1],
(int)exif_length);
printf(" eXIf type %c%c, %lu bytes\n",exif[0],exif[1],
(unsigned long)exif_length);
# ifdef PNG_WRITE_eXIf_SUPPORTED
png_set_eXIf(write_ptr, write_end_info_ptr, exif);
png_set_eXIf_1(write_ptr, write_end_info_ptr, exif_length, exif);
# endif
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册