1diff --git a/pngset.c b/pngset.c 2index cccd9cd..83d6ce2 100644 3--- a/pngset.c 4+++ b/pngset.c 5@@ -283,17 +283,29 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforpinfo_ptr, 6 7 /* Check that the type matches the specification. */ 8 if (type < 0 || type > 3) 9- png_error(png_ptr, "Invalid pCAL equation type"); 10+ { 11+ png_chunk_report(png_ptr, "Invalid pCAL equation type", 12+ PNG_CHUNK_WRITE_ERROR); 13+ return; 14+ } 15 16 if (nparams < 0 || nparams > 255) 17- png_error(png_ptr, "Invalid pCAL parameter count"); 18+ { 19+ png_chunk_report(png_ptr, "Invalid pCAL parameter count", 20+ PNG_CHUNK_WRITE_ERROR); 21+ return; 22+ } 23 24 /* Validate params[nparams] */ 25 for (i=0; i<nparams; ++i) 26 { 27 if (params[i] == NULL || 28 !png_check_fp_string(params[i], strlen(params[i]))) 29- png_error(png_ptr, "Invalid format for pCAL parameter"); 30+ { 31+ png_chunk_report(png_ptr, "Invalid format for pCAL parameter", 32+ PNG_CHUNK_WRITE_ERROR); 33+ return; 34+ } 35 } 36 37 info_ptr->pcal_purpose = png_voidcast(png_charp, 38@@ -301,8 +313,8 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforpinfo_ptr, 39 40 if (info_ptr->pcal_purpose == NULL) 41 { 42- png_warning(png_ptr, "Insufficient memory for pCAL purpose"); 43- 44+ png_chunk_report(png_ptr, "Insufficient memory for pCAL purpose", 45+ PNG_CHUNK_WRITE_ERROR); 46 return; 47 } 48