Report a problem when processing large jp2 image.
Posted: 2013-12-23T12:24:33-07:00
Magik, Sorry for the multiple topics. I thought it will be easier for you to read.
here is the testing file
http://www.microimages.com/gallery/jp2/CB_TM_QQ432.jp2
I found a problem in Core_jp2 package. When process large jp2 image, jasper library will use disk file to store the color components value. However the process to create temporary file has problem.
the problem is locate In CORE_jp2
File jas_stream.c
jas_stream_t *jas_stream_tmpfile()
{…
/* Choose a file name. */
//tmpnam(obj->pathname);
/**
* this call try to create a temporary file, however it doestn’t always work */
_snprintf(obj->pathname, L_tmpnam, "%stmp-XXXXXXXXXX", P_tmpdir);
…
}
I understand why the developer want to replace the tmpnam. However his fix doesn’t always work, and also this call will be used in a loop to store multi-color components, which will definitely cause problem.
I uncommented the tmpname(obj->pathname) and removed the _snprintf(obj->pathname, L_tmpnam, "%stmp-XXXXXXXXXX", P_tmpdir) line, it worked for my purpose.
here is the testing file
http://www.microimages.com/gallery/jp2/CB_TM_QQ432.jp2
I found a problem in Core_jp2 package. When process large jp2 image, jasper library will use disk file to store the color components value. However the process to create temporary file has problem.
the problem is locate In CORE_jp2
File jas_stream.c
jas_stream_t *jas_stream_tmpfile()
{…
/* Choose a file name. */
//tmpnam(obj->pathname);
/**
* this call try to create a temporary file, however it doestn’t always work */
_snprintf(obj->pathname, L_tmpnam, "%stmp-XXXXXXXXXX", P_tmpdir);
…
}
I understand why the developer want to replace the tmpnam. However his fix doesn’t always work, and also this call will be used in a loop to store multi-color components, which will definitely cause problem.
I uncommented the tmpname(obj->pathname) and removed the _snprintf(obj->pathname, L_tmpnam, "%stmp-XXXXXXXXXX", P_tmpdir) line, it worked for my purpose.