[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).
This commit is contained in:
parent
a1fe2c9848
commit
d930d36155
2
ANNOUNCE
2
ANNOUNCE
@ -61,6 +61,8 @@ Version 1.6.32beta07 [Auguest 3, 2017]
|
|||||||
Version 1.6.32beta08 [August 3, 2017]
|
Version 1.6.32beta08 [August 3, 2017]
|
||||||
Check length of IDAT against maximum possible IDAT size, accounting
|
Check length of IDAT against maximum possible IDAT size, accounting
|
||||||
for height, rowbytes, interlacing and zlib/deflate overhead.
|
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
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
2
CHANGES
2
CHANGES
@ -5944,6 +5944,8 @@ Version 1.6.32beta07 [Auguest 3, 2017]
|
|||||||
Version 1.6.32beta08 [August 3, 2017]
|
Version 1.6.32beta08 [August 3, 2017]
|
||||||
Check length of IDAT against maximum possible IDAT size, accounting
|
Check length of IDAT against maximum possible IDAT size, accounting
|
||||||
for height, rowbytes, interlacing and zlib/deflate overhead.
|
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
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
6
png.h
6
png.h
@ -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_inforp info_ptr, png_bytep *exif));
|
||||||
PNG_EXPORT(247, void, png_set_eXIf, (png_const_structrp png_ptr,
|
PNG_EXPORT(247, void, png_set_eXIf, (png_const_structrp png_ptr,
|
||||||
png_inforp info_ptr, const png_bytep exif));
|
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
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_gAMA_SUPPORTED
|
#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.)
|
* one to use is one more than this.)
|
||||||
*/
|
*/
|
||||||
#ifdef PNG_EXPORT_LAST_ORDINAL
|
#ifdef PNG_EXPORT_LAST_ORDINAL
|
||||||
PNG_EXPORT_LAST_ORDINAL(247);
|
PNG_EXPORT_LAST_ORDINAL(249);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
11
pngget.c
11
pngget.c
@ -777,12 +777,23 @@ png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
|
png_get_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
png_bytep *exif)
|
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");
|
png_debug1(1, "in %s retrieval function", "eXIf");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_eXIf) != 0 && exif != NULL)
|
(info_ptr->valid & PNG_INFO_eXIf) != 0 && exif != NULL)
|
||||||
{
|
{
|
||||||
|
*num_exif = info_ptr->num_exif;
|
||||||
*exif = info_ptr->exif;
|
*exif = info_ptr->exif;
|
||||||
return (PNG_INFO_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)
|
if (png_crc_finish(png_ptr, 0) != 0)
|
||||||
return;
|
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);
|
png_free(png_ptr, info_ptr->eXIf_buf);
|
||||||
info_ptr->eXIf_buf = NULL;
|
info_ptr->eXIf_buf = NULL;
|
||||||
|
11
pngset.c
11
pngset.c
@ -138,6 +138,15 @@ png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X,
|
|||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
|
png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
const png_bytep eXIf_buf)
|
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;
|
int i;
|
||||||
|
|
||||||
@ -152,7 +161,7 @@ png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||||||
info_ptr->exif = NULL;
|
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->exif = png_voidcast(png_bytep, png_malloc_warn(png_ptr,
|
||||||
info_ptr->num_exif));
|
info_ptr->num_exif));
|
||||||
|
18
pngtest.c
18
pngtest.c
@ -1201,16 +1201,15 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
#ifdef PNG_READ_eXIf_SUPPORTED
|
#ifdef PNG_READ_eXIf_SUPPORTED
|
||||||
{
|
{
|
||||||
png_bytep exif=NULL;
|
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)
|
if (exif_length > 1)
|
||||||
printf(" eXIf type %c%c, %lu bytes\n",exif[0],exif[1],
|
printf(" eXIf type %c%c, %lu bytes\n",exif[0],exif[1],
|
||||||
exif_length);
|
(unsigned long)exif_length);
|
||||||
# ifdef PNG_WRITE_eXIf_SUPPORTED
|
# 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
|
# endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1562,14 +1561,13 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
png_bytep exif=NULL;
|
png_bytep exif=NULL;
|
||||||
png_uint_32 exif_length;
|
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)
|
if (exif_length > 1)
|
||||||
printf(" eXIf type %c%c, %d bytes\n",exif[0],exif[1],
|
printf(" eXIf type %c%c, %lu bytes\n",exif[0],exif[1],
|
||||||
(int)exif_length);
|
(unsigned long)exif_length);
|
||||||
# ifdef PNG_WRITE_eXIf_SUPPORTED
|
# 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
|
# endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user