summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ANNOUNCE2
-rw-r--r--CHANGES2
-rw-r--r--png.h6
-rw-r--r--pngget.c11
-rw-r--r--pngrutil.c2
-rw-r--r--pngset.c11
-rw-r--r--pngtest.c18
7 files changed, 39 insertions, 13 deletions
diff --git a/ANNOUNCE b/ANNOUNCE
index a8f52d7e8..2f09057d2 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -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
diff --git a/CHANGES b/CHANGES
index d2dc000a7..889c0d1e4 100644
--- a/CHANGES
+++ b/CHANGES
@@ -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
diff --git a/png.h b/png.h
index a2cd990bf..46ed7d8e5 100644
--- a/png.h
+++ b/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_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
diff --git a/pngget.c b/pngget.c
index 9068952f8..5046db58a 100644
--- a/pngget.c
+++ b/pngget.c
@@ -778,11 +778,22 @@ 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);
}
diff --git a/pngrutil.c b/pngrutil.c
index 703f03d84..f7964fc9a 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -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;
diff --git a/pngset.c b/pngset.c
index fc8bbc86b..0efebb00a 100644
--- a/pngset.c
+++ b/pngset.c
@@ -139,6 +139,15 @@ 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;
png_debug1(1, "in %s storage function", "eXIf");
@@ -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));
diff --git a/pngtest.c b/pngtest.c
index dfa2ad300..378654742 100644
--- a/pngtest.c
+++ b/pngtest.c
@@ -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
}
}