Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: third_party/libpng16/0003-check-errors-in-set-pcal.patch

Issue 2292313003: Avoid leaking params if any entry bad. (Closed)
Patch Set: Update patch Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/libpng16/README.pdfium » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/libpng16/0003-check-errors-in-set-pcal.patch
diff --git a/third_party/libpng16/0003-check-errors-in-set-pcal.patch b/third_party/libpng16/0003-check-errors-in-set-pcal.patch
new file mode 100644
index 0000000000000000000000000000000000000000..58e27ba62371576d916c603e0615e5e22eb44205
--- /dev/null
+++ b/third_party/libpng16/0003-check-errors-in-set-pcal.patch
@@ -0,0 +1,47 @@
+diff --git a/pngset.c b/pngset.c
+index cccd9cd..83d6ce2 100644
+--- a/pngset.c
++++ b/pngset.c
+@@ -283,17 +283,29 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforpinfo_ptr,
+
+ /* Check that the type matches the specification. */
+ 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)
+- 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] */
+ for (i=0; i<nparams; ++i)
+ {
+ if (params[i] == NULL ||
+ !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,
+@@ -301,8 +313,8 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforpinfo_ptr,
+
+ 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;
+ }
« no previous file with comments | « no previous file | third_party/libpng16/README.pdfium » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698