Hi all,

I'm trying to read the first 4 bytes from a profile (to get the tag
type), and I'm doing something like this:

cmsTagSignature sig;
char buffer[4];
sig = cmsGetTagSignature(hProfile, i);
tag_size = cmsReadRawTag(hProfile, sig, buffer, 4);

This returns the correct tag_size, but running this under valgrind
seems to suggest that rather than writing 4 bytes into buffer (which
is what I asked for), tag_size bytes seem to be written. This makes
buffer overflow, and depending on how forgiving the compiler has been
and the size of the raw tag, the program crashes in random places.
Throw -fPIE into the mix and it crashes every time.

I'm not completely sure how to fix this, as MemIO->Tell is used to
return the size of the tag, which isn't going to be correct if the
buffer size is too small to fit the entire tag in.

I couldn't see a better way to extract the cmsTagTypeSignature when
iterating cmsGetTagCount, maybe an accessor is also a good idea.

Ideas very welcome, thanks.

Richard.

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to