@@ -470,7 +470,7 @@ ImageSpec::find_attribute(string_view name, ParamValue& tmpparam,
470470 auto iter = extra_attribs.find (name, searchtype, casesensitive);
471471 if (iter != extra_attribs.end ())
472472 return &(*iter);
473- // Check named items in the ImageSpec structs, not in extra_attrubs
473+ // Check named items in the ImageSpec structs, not in extra_attrubs
474474#define MATCH (n, t ) \
475475 (((!casesensitive && Strutil::iequals (name, n)) \
476476 || (casesensitive && name == n)) \
@@ -1290,9 +1290,10 @@ ImageSpec::set_cicp(string_view cicp)
12901290 }
12911291 auto vals = Strutil::extract_from_list_string<int >(" 0,0,0,1" , 4 , 0 );
12921292 auto p = find_attribute (" oiio:CICP" , TypeDesc (TypeDesc::UINT8, 4 ));
1293- if (p) {
1294- string_view existing_vals = metadata_val (*p);
1295- Strutil::extract_from_list_string<int >(vals, existing_vals);
1293+ if (p && p->type () == TypeDesc (TypeDesc::UINT8, 4 ) && p->nvalues () == 4 ) {
1294+ const uint8_t * existing = static_cast <const uint8_t *>(p->data ());
1295+ for (int i = 0 ; i < 4 ; ++i)
1296+ vals[i] = existing[i];
12961297 }
12971298 Strutil::extract_from_list_string<int >(vals, cicp);
12981299 set_cicp (vals[0 ], vals[1 ], vals[2 ], vals[3 ]);
0 commit comments