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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/libpng16/README.pdfium » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 diff --git a/pngset.c b/pngset.c
2 index 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_pt r,
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 }
OLDNEW
« 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