mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng16] png_set_pCAL: do not png_error on read
Because png_handle_pCAL has allocated memory to free. Signed-off-by: John Bowler <jbowler@acm.org>
This commit is contained in:
parent
90ea4af4a1
commit
7dc0329250
22
pngset.c
22
pngset.c
@ -283,17 +283,29 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||||||
|
|
||||||
/* Check that the type matches the specification. */
|
/* Check that the type matches the specification. */
|
||||||
if (type < 0 || type > 3)
|
if (type < 0 || type > 3)
|
||||||
png_error(png_ptr, "Invalid pCAL equation type");
|
{
|
||||||
|
png_chunk_report(png_ptr, "Invalid pCAL equation type",
|
||||||
|
PNG_CHUNK_WRITE_ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (nparams < 0 || nparams > 255)
|
if (nparams < 0 || nparams > 255)
|
||||||
png_error(png_ptr, "Invalid pCAL parameter count");
|
{
|
||||||
|
png_chunk_report(png_ptr, "Invalid pCAL parameter count",
|
||||||
|
PNG_CHUNK_WRITE_ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Validate params[nparams] */
|
/* Validate params[nparams] */
|
||||||
for (i=0; i<nparams; ++i)
|
for (i=0; i<nparams; ++i)
|
||||||
{
|
{
|
||||||
if (params[i] == NULL ||
|
if (params[i] == NULL ||
|
||||||
!png_check_fp_string(params[i], strlen(params[i])))
|
!png_check_fp_string(params[i], strlen(params[i])))
|
||||||
png_error(png_ptr, "Invalid format for pCAL parameter");
|
{
|
||||||
|
png_chunk_report(png_ptr, "Invalid format for pCAL parameter",
|
||||||
|
PNG_CHUNK_WRITE_ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
info_ptr->pcal_purpose = png_voidcast(png_charp,
|
info_ptr->pcal_purpose = png_voidcast(png_charp,
|
||||||
@ -301,8 +313,8 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||||||
|
|
||||||
if (info_ptr->pcal_purpose == NULL)
|
if (info_ptr->pcal_purpose == NULL)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Insufficient memory for pCAL purpose");
|
png_chunk_report(png_ptr, "Insufficient memory for pCAL purpose",
|
||||||
|
PNG_CHUNK_WRITE_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user