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

Side by Side Diff: third_party/qcms/src/iccread.c

Issue 1138473002: qcms: Limit vcgt table to a maximum of 1024 entries (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « third_party/qcms/google.patch ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* vim: set ts=8 sw=8 noexpandtab: */ 1 /* vim: set ts=8 sw=8 noexpandtab: */
2 // qcms 2 // qcms
3 // Copyright (C) 2009 Mozilla Foundation 3 // Copyright (C) 2009 Mozilla Foundation
4 // Copyright (C) 1998-2007 Marti Maria 4 // Copyright (C) 1998-2007 Marti Maria
5 // 5 //
6 // Permission is hereby granted, free of charge, to any person obtaining 6 // Permission is hereby granted, free of charge, to any person obtaining
7 // a copy of this software and associated documentation files (the "Software"), 7 // a copy of this software and associated documentation files (the "Software"),
8 // to deal in the Software without restriction, including without limitation 8 // to deal in the Software without restriction, including without limitation
9 // the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 // and/or sell copies of the Software, and to permit persons to whom the Softwar e 10 // and/or sell copies of the Software, and to permit persons to whom the Softwar e
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 379
380 // Only support 3 channels. 380 // Only support 3 channels.
381 if (channels != 3) 381 if (channels != 3)
382 return true; 382 return true;
383 // Only support single or double byte values. 383 // Only support single or double byte values.
384 if (byte_depth != 1 && byte_depth != 2) 384 if (byte_depth != 1 && byte_depth != 2)
385 return true; 385 return true;
386 // Only support table data, not equation. 386 // Only support table data, not equation.
387 if (vcgt_type != 0) 387 if (vcgt_type != 0)
388 return true; 388 return true;
389 // Limit the table to a sensible size; 10-bit gamma is a reasonable
390 // maximum for hardware correction.
391 if (elements > 1024)
392 return true;
389 393
390 // Empty table is invalid. 394 // Empty table is invalid.
391 if (!elements) 395 if (!elements)
392 goto invalid_vcgt_tag; 396 goto invalid_vcgt_tag;
393 397
394 profile->vcgt.length = elements; 398 profile->vcgt.length = elements;
395 profile->vcgt.data = malloc(3 * elements * sizeof(uint16_t)); 399 profile->vcgt.data = malloc(3 * elements * sizeof(uint16_t));
396 if (!profile->vcgt.data) 400 if (!profile->vcgt.data)
397 return false; 401 return false;
398 402
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 { 1476 {
1473 qcms_profile *profile = NULL; 1477 qcms_profile *profile = NULL;
1474 FILE *file = _wfopen(path, L"rb"); 1478 FILE *file = _wfopen(path, L"rb");
1475 if (file) { 1479 if (file) {
1476 profile = qcms_profile_from_file(file); 1480 profile = qcms_profile_from_file(file);
1477 fclose(file); 1481 fclose(file);
1478 } 1482 }
1479 return profile; 1483 return profile;
1480 } 1484 }
1481 #endif 1485 #endif
OLDNEW
« no previous file with comments | « third_party/qcms/google.patch ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698