Works fine for me on both Linux and OSX.
I'm wondering if perhaps the problem is on the JPEG library end, rather than
with OIIO or std::string per se. Which version of libjpeg are you using?
Can you try something for me? Alter the code as follows, and let's see what
happens:
else if (m->marker == JPEG_COM) {
if (! m_spec.find_attribute ("ImageDescription", TypeDesc::STRING))
{
printf ("About to access m->data\n");
printf ("m->data is a string of length %d\n", strlen((const
char *)m->data));
std::string s = std::string ((const char *)m->data);
printf ("grabbed the string: '%s'\n", s.c_str());
m_spec.attribute ("ImageDescription", s);
printf ("completed\n");
}
Here's my suspicion: that somehow with your version of libjpeg, the data in
m->data is not a valid string (not NULL-terminated, for example). If this is
the case, then std::string is a red herring -- changing everything to char*
would not help at all.
On Apr 9, 2013, at 3:23 AM, Michel Lerenard wrote:
> Hi everybody
>
> In my other post i mentionned a crash with a specific file. We've been able
> to find the source of the crash, and it seems to be the comment field stored
> in metadata: oiio crashed in jpeginput, line 235:
>
> else if (m->marker == JPEG_COM) {
> if (! m_spec.find_attribute ("ImageDescription",
> TypeDesc::STRING))
> m_spec.attribute ("ImageDescription",
> std::string ((const char *)m->data));
> }
>
> We failed to understand why, being unable to see the content of the
> variables. The file can be opened without any issue in XnView, Gimp,
> ImageMagick. We have commented the line of code, and the file could be loaded
> successfully.
>
> I've attached the file, if someone using windows can try to load it, i'd like
> to know if it works.
>
> Thanks.
> <concrete.jpg>_______________________________________________
> Oiio-dev mailing list
> [email protected]
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
--
Larry Gritz
[email protected]
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org