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

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

Issue 850793004: Update from https://crrev.com/311346 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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/README.chromium ('k') | tools/valgrind/drmemory/suppressions.txt » ('j') | 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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 359
360 static bool read_tag_descType(qcms_profile *profile, struct mem_source *src, str uct tag_index index, uint32_t tag_id) 360 static bool read_tag_descType(qcms_profile *profile, struct mem_source *src, str uct tag_index index, uint32_t tag_id)
361 { 361 {
362 struct tag *tag = find_tag(index, tag_id); 362 struct tag *tag = find_tag(index, tag_id);
363 if (tag) { 363 if (tag) {
364 const uint32_t limit = sizeof profile->description; 364 const uint32_t limit = sizeof profile->description;
365 uint32_t offset = tag->offset; 365 uint32_t offset = tag->offset;
366 uint32_t type = read_u32(src, offset); 366 uint32_t type = read_u32(src, offset);
367 uint32_t length = read_u32(src, offset+8); 367 uint32_t length = read_u32(src, offset+8);
368 uint32_t i, description; 368 uint32_t i, description;
369 bool mluc = false;
369 if (length && type == MLUC_TYPE) { 370 if (length && type == MLUC_TYPE) {
370 length = read_u32(src, offset+20); 371 length = read_u32(src, offset+20);
371 if (!length || (length & 1) || (read_u32(src, offset+12) != 12)) 372 if (!length || (length & 1) || (read_u32(src, offset+12) != 12))
372 goto invalid_desc_tag; 373 goto invalid_desc_tag;
373 description = offset + read_u32(src, offset+24); 374 description = offset + read_u32(src, offset+24);
374 if (!src->valid) 375 if (!src->valid)
375 goto invalid_desc_tag; 376 goto invalid_desc_tag;
377 mluc = true;
376 } else if (length && type == DESC_TYPE) { 378 } else if (length && type == DESC_TYPE) {
377 description = offset + 12; 379 description = offset + 12;
378 } else { 380 } else {
379 goto invalid_desc_tag; 381 goto invalid_desc_tag;
380 } 382 }
381 if (length >= limit) 383 if (length >= limit)
382 length = limit - 1; 384 length = limit - 1;
383 » » for (i = 0; i < length; ++i) 385 » » for (i = 0; i < length; ++i) {
384 » » » profile->description[i] = read_u8(src, description+i); 386 » » » uint8_t value = read_u8(src, description+i);
387 » » » if (!src->valid)
388 » » » » goto invalid_desc_tag;
389 » » » if (mluc && !value)
390 » » » » value = '.';
391 » » » profile->description[i] = value;
392 » » }
385 profile->description[length] = 0; 393 profile->description[length] = 0;
386 } else { 394 } else {
387 goto invalid_desc_tag; 395 goto invalid_desc_tag;
388 } 396 }
389 397
390 if (src->valid) 398 if (src->valid)
391 return true; 399 return true;
392 400
393 invalid_desc_tag: 401 invalid_desc_tag:
394 invalid_source(src, "invalid description"); 402 invalid_source(src, "invalid description");
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after
1269 { 1277 {
1270 qcms_profile *profile = NULL; 1278 qcms_profile *profile = NULL;
1271 FILE *file = _wfopen(path, L"rb"); 1279 FILE *file = _wfopen(path, L"rb");
1272 if (file) { 1280 if (file) {
1273 profile = qcms_profile_from_file(file); 1281 profile = qcms_profile_from_file(file);
1274 fclose(file); 1282 fclose(file);
1275 } 1283 }
1276 return profile; 1284 return profile;
1277 } 1285 }
1278 #endif 1286 #endif
OLDNEW
« no previous file with comments | « third_party/qcms/README.chromium ('k') | tools/valgrind/drmemory/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698